Skip to content
Snippets Groups Projects
Commit fe51c01c authored by Demian Katz's avatar Demian Katz
Browse files

Flag this error as a bad request.

parent e9f47d4f
No related merge requests found
......@@ -251,7 +251,9 @@ class CombinedController extends AbstractSearch
return $this->redirect()->toRoute('home');
}
// If we have a weird value here, report it as an Exception:
throw new \Exception('Unexpected search type: "' . $type . '".');
throw new \VuFind\Exception\BadRequest(
'Unexpected search type: "' . $type . '".'
);
}
}
......
<?php
/**
* "Bad Request" Exception
*
* PHP version 5
*
* Copyright (C) Villanova University 2016.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Exceptions
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
namespace VuFind\Exception;
/**
* "Bad Request" Exception
*
* @category VuFind
* @package Exceptions
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
class BadRequest extends \Exception implements HttpStatusInterface
{
/**
* Get HTTP status associated with this exception.
*
* @return int
*/
public function getHttpStatus()
{
return 400;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment