diff --git a/library/Icinga/Web/Controller.php b/library/Icinga/Web/Controller.php index b397a19f6..1e636aa33 100644 --- a/library/Icinga/Web/Controller.php +++ b/library/Icinga/Web/Controller.php @@ -6,6 +6,7 @@ namespace Icinga\Web; use Icinga\Data\Filterable; use Icinga\Data\Sortable; use Icinga\Data\QueryInterface; +use Icinga\Exception\Http\HttpBadRequestException; use Icinga\Exception\Http\HttpNotFoundException; use Icinga\Web\Controller\ModuleActionController; use Icinga\Web\Widget\Limiter; @@ -51,6 +52,19 @@ class Controller extends ModuleActionController } } + /** + * Immediately respond w/ HTTP 400 + * + * @param string $message Exception message or exception format string + * @param mixed ...$arg Format string argument + * + * @throws HttpBadRequestException + */ + public function httpBadRequest($message) + { + throw HttpBadRequestException::create(func_get_args()); + } + /** * Immediately respond w/ HTTP 404 *