Code cleanup for subuser API endpoints; closes #2247

This commit is contained in:
Dane Everitt 2020-08-19 20:21:12 -07:00
parent 57bb652d81
commit 61e9771333
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 94 additions and 104 deletions

View file

@ -213,6 +213,13 @@ class Handler extends ExceptionHandler
'detail' => 'An error was encountered while processing this request.',
];
if ($exception instanceof ModelNotFoundException || $exception->getPrevious() instanceof ModelNotFoundException) {
// Show a nicer error message compared to the standard "No query results for model"
// response that is normally returned. If we are in debug mode this will get overwritten
// with a more specific error message to help narrow down things.
$error['detail'] = 'The requested resource could not be found on the server.';
}
if (config('app.debug')) {
$error = array_merge($error, [
'detail' => $exception->getMessage(),