Skip to content

Commit f0e64ed

Browse files
authored
Log http request exceptions without stack (#42)
* log http request exceptions without stack * fix ci setup * stan fix
1 parent 68f0a5d commit f0e64ed

File tree

9 files changed

+1252
-891
lines changed

9 files changed

+1252
-891
lines changed

.github/workflows/pint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup PHP
1313
uses: shivammathur/setup-php@v2
1414
with:
15-
php-version: '8.3'
15+
php-version: '8.4'
1616
extensions: pcntl, curl, pdo_mysql, zip, curl, redis
1717
coverage: none
1818

.github/workflows/stan.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup PHP
1313
uses: shivammathur/setup-php@v2
1414
with:
15-
php-version: '8.3'
15+
php-version: '8.4'
1616
coverage: none
1717

1818
- name: Install composer dependencies

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup PHP
1313
uses: shivammathur/setup-php@v2
1414
with:
15-
php-version: '8.3'
15+
php-version: '8.4'
1616
extensions: pcntl, curl, pdo_mysql, zip, curl, redis
1717
coverage: none
1818

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM dunglas/frankenphp
1+
FROM dunglas/frankenphp:php8.4
22
ARG UID
33
ARG GID
44

app/RemoteSite/WebserviceEndpoint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function getMethod(): HttpMethod
3333
return HttpMethod::POST;
3434
}
3535

36+
// @phpstan-ignore-next-line
3637
throw new \ValueError("No method defined");
3738
}
3839

@@ -52,6 +53,7 @@ public function getResponseClass(): string
5253
return Notification::class;
5354
}
5455

56+
// @phpstan-ignore-next-line
5557
throw new \ValueError("No response defined");
5658
}
5759

bootstrap/app.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22

3+
use GuzzleHttp\Exception\ClientException;
4+
use GuzzleHttp\Exception\ServerException;
35
use Illuminate\Foundation\Application;
46
use Illuminate\Foundation\Configuration\Exceptions;
57
use Illuminate\Foundation\Configuration\Middleware;
68
use Illuminate\Foundation\Http\Middleware\ValidateCsrfToken;
79
use Illuminate\Session\Middleware\StartSession;
10+
use Illuminate\Support\Facades\Log;
811
use Illuminate\View\Middleware\ShareErrorsFromSession;
912

1013
return Application::configure(basePath: dirname(__DIR__))
@@ -26,5 +29,11 @@
2629
]);
2730
})
2831
->withExceptions(function (Exceptions $exceptions) {
29-
//
32+
$exceptions->report(function (ServerException|ClientException $e) {
33+
Log::warning('HTTP Request Exception', [
34+
'url' => (string) $e->getRequest()->getUri(),
35+
'status' => $e->getResponse()->getStatusCode(),
36+
'body' => $e->getResponse()->getBody(),
37+
]);
38+
})->stop();
3039
})->create();

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"keywords": ["laravel", "framework"],
66
"license": "MIT",
77
"require": {
8-
"php": "^8.3",
9-
"guzzlehttp/guzzle": "^7.9",
10-
"laravel/framework": "^11.9",
8+
"php": "^8.4",
9+
"guzzlehttp/guzzle": "^7.9.3",
10+
"laravel/framework": "^11.46",
1111
"laravel/horizon": "^5.29",
1212
"laravel/octane": "^2.5",
1313
"laravel/tinker": "^2.9",

0 commit comments

Comments
 (0)