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
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Exceptions\MicropubHandlerException;
|
||||
use App\Jobs\SendWebMentions;
|
||||
use App\Jobs\SyndicateNoteToBluesky;
|
||||
use App\Jobs\SyndicateNoteToMastodon;
|
||||
|
|
@ -12,6 +13,7 @@ use App\Models\Note;
|
|||
use App\Models\Place;
|
||||
use App\Models\SyndicationTarget;
|
||||
use Faker\Factory;
|
||||
use Illuminate\Contracts\Debug\ExceptionHandler;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
|
|
@ -457,6 +459,11 @@ class MicropubControllerTest extends TestCase
|
|||
#[Test]
|
||||
public function micropub_client_api_request_for_unsupported_post_type_returns_error(): void
|
||||
{
|
||||
$this->mock(ExceptionHandler::class)
|
||||
->shouldReceive('report')
|
||||
->once()
|
||||
->with(\Mockery::type(MicropubHandlerException::class));
|
||||
|
||||
$response = $this->postJson(
|
||||
'/api/post',
|
||||
[
|
||||
|
|
|
|||
Loading…
Reference in a new issue