Report exceptions from Micropub 500 error paths instead of swallowing them
MicropubController's catch-all handlers returned a generic 500 without ever calling report(), so failures never reached laravel.log or Flare (Flare is already wired up via bootstrap/app.php). Widened the final catch to \Throwable so PHP Errors (e.g. TypeError) get the same Micropub-shaped error response and are also reported. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
4aa93d63bb
commit
6727138f43
2 changed files with 16 additions and 3 deletions
|
|
@ -70,7 +70,9 @@ class MicropubController extends Controller
|
|||
'error' => 'invalid_request',
|
||||
'error_description' => 'No known note with given ID',
|
||||
], 404);
|
||||
} catch (MicropubUnsupportedModelException) {
|
||||
} catch (MicropubUnsupportedModelException $e) {
|
||||
report($e);
|
||||
|
||||
return response()->json([
|
||||
'error' => 'invalid',
|
||||
'error_description' => 'This implementation currently only supports the updating of notes',
|
||||
|
|
@ -80,12 +82,16 @@ class MicropubController extends Controller
|
|||
'error' => 'invalid_request',
|
||||
'error_description' => $e->getMessage(),
|
||||
], 400);
|
||||
} catch (MicropubHandlerException) {
|
||||
} catch (MicropubHandlerException $e) {
|
||||
report($e);
|
||||
|
||||
return response()->json([
|
||||
'error' => 'unsupported_operation',
|
||||
'error_description' => 'The request could not be processed by this server',
|
||||
], 500);
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
report($e);
|
||||
|
||||
return response()->json([
|
||||
'error' => 'server_error',
|
||||
'error_description' => 'An error occurred processing the request',
|
||||
|
|
|
|||
Loading…
Reference in a new issue