Skip to content
Snippets Groups Projects
Commit 5b5ef2fe authored by xamgore's avatar xamgore
Browse files

Return err message with 422 exception

parent 4e0fd321
Branches
Tags
No related merge requests found
......@@ -26,7 +26,7 @@ class Controller_Handler extends Controller
return $res;
}
protected function fail() {
throw HTTP_Exception::factory(422)->request($this->request);
protected function fail($message = null) {
throw HTTP_Exception::factory(422, $message)->request($this->request);
}
}
......@@ -35,6 +35,9 @@ abstract class Kohana_HTTP_Exception_Expected extends HTTP_Exception {
// Prepare our response object and set the correct status code.
$this->_response = Response::factory()
->status($this->_code);
if (!is_null($message))
$this->_response->body($message);
}
/**
......
......@@ -196,7 +196,7 @@ class Kohana_Response implements HTTP_Response {
* $status = $response->status();
*
* @param integer $status Status to set to this response
* @return mixed
* @return self|mixed
*/
public function status($status = NULL)
{
......
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