mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #296 from chillu/pulls/validationexception-routing
API Handle uncaught ValidationException on CMS controller execution
This commit is contained in:
commit
414f60ad2f
@ -314,6 +314,15 @@ class LeftAndMain extends Controller {
|
||||
SSViewer::set_theme(null);
|
||||
}
|
||||
|
||||
public function handleRequest(SS_HTTPRequest $request) {
|
||||
try {
|
||||
return parent::handleRequest($request);
|
||||
} catch(ValidationException $e) {
|
||||
// Nicer presentation of model-level validation errors
|
||||
return $this->httpError(403, $e->getResult()->message());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this is set to true, the "switchView" context in the
|
||||
|
Loading…
Reference in New Issue
Block a user