Report exceptions from Micropub 500 error paths instead of swallowing them #136

Merged
jonny merged 1 commit from log-micropub-controller-errors into develop 2026-09-19 13:46:33 +02:00
Owner

Summary

  • MicropubController::post() had a catch-all that 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).
  • The final catch is widened from \Exception to \Throwable so PHP Errors (e.g. TypeError) get the same Micropub-shaped JSON error response and are also reported.
  • The two other 500-returning catches (MicropubUnsupportedModelException, MicropubHandlerException) now report too.

Triggered by a real incident: a Micropub POST returned a 500 with nothing in laravel.log and nothing in Flare. Traced it to this swallowed exception - the response body was exactly 87 bytes, matching the nginx access log's byte count for that request.

Test plan

  • ./vendor/bin/sail test --filter=MicropubControllerTest - 41 passed, including a new assertion that report() is invoked on the MicropubHandlerException 500 path
  • ./vendor/bin/sail test - full suite, 377 passed
  • ./vendor/bin/pint --test - clean

🤖 Generated with Claude Code

## Summary - `MicropubController::post()` had a catch-all that 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`). - The final catch is widened from `\Exception` to `\Throwable` so PHP Errors (e.g. `TypeError`) get the same Micropub-shaped JSON error response and are also reported. - The two other 500-returning catches (`MicropubUnsupportedModelException`, `MicropubHandlerException`) now report too. Triggered by a real incident: a Micropub POST returned a 500 with nothing in `laravel.log` and nothing in Flare. Traced it to this swallowed exception - the response body was exactly 87 bytes, matching the nginx access log's byte count for that request. ## Test plan - [x] `./vendor/bin/sail test --filter=MicropubControllerTest` - 41 passed, including a new assertion that `report()` is invoked on the `MicropubHandlerException` 500 path - [x] `./vendor/bin/sail test` - full suite, 377 passed - [x] `./vendor/bin/pint --test` - clean 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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>
jonny merged commit 6727138f43 into develop 2026-09-19 13:46:33 +02:00
jonny deleted branch log-micropub-controller-errors 2026-09-19 13:46:34 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jonny/jonnybarnes.uk!136
No description provided.