File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ## [ 1.5.1] - 2025-11-10
11+ ### Fixed
12+ - Fixed leaking Guzzle exceptions (e.g. ` ConnectException ` ) from the HTTP client. An exception ` UnexpectedErrorException ` is thrown instead.
13+
1014## [ 1.5.0] - 2024-05-23
1115### Added
1216- Added support for content type ` noContent ` .
Original file line number Diff line number Diff line change 55namespace SixtyEightPublishers \AmpClient \Http \Middleware ;
66
77use Closure ;
8+ use Exception ;
89use GuzzleHttp \Promise \PromiseInterface ;
910use Psr \Http \Message \RequestInterface ;
1011use SixtyEightPublishers \AmpClient \Exception \AmpExceptionInterface ;
@@ -27,7 +28,11 @@ public function __invoke(Closure $next): Closure
2728 {
2829 return static function (RequestInterface $ request , array $ options ) use ($ next ): PromiseInterface {
2930 try {
30- return $ next ($ request , $ options );
31+ return $ next ($ request , $ options )->otherwise (function ($ e ) {
32+ throw new UnexpectedErrorException (
33+ $ e instanceof Throwable ? $ e : new Exception ('Unknown error. ' ),
34+ );
35+ });
3136 } catch (Throwable $ e ) {
3237 throw ($ e instanceof AmpExceptionInterface ? $ e : new UnexpectedErrorException ($ e ));
3338 }
You can’t perform that action at this time.
0 commit comments