Skip to content

Commit

Permalink
Use new Laravel 11 style exception handling to test error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
asgrim committed Jun 7, 2024
1 parent e6885db commit 915e4de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/fixtures/laravel11-app-with-exceptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
$exceptions->reportable(function (Throwable $e) {
$this->container->make(\Scoutapm\ScoutApmAgent::class)->recordThrowable($e);
});
})->create();
5 changes: 4 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,12 @@ jobs:
- name: "Configure error handler (Laravel 8)"
if: matrix.laravel-version == '8.*'
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel8-exception-handler.php app/Exceptions/Handler.php
- name: "Configure error handler (Laravel 9)"
- name: "Configure error handler (Laravel 9-10)"
if: matrix.laravel-version == '9.*' || matrix.laravel-version == '10.*'
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel9-exception-handler.php app/Exceptions/Handler.php
- name: "Configure error handler (Laravel 11)"
if: matrix.laravel-version == '11.*'
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel11-app-with-exceptions.php bootstrap/app.php
- name: "Add route to trigger error"
run: cd test-app && echo -e "Route::get('/e', function () { throw new \RuntimeException('fail'); });" >> routes/web.php
- name: "Configure Scout"
Expand Down

0 comments on commit 915e4de

Please sign in to comment.