Fixed leaking Guzzle exceptions from the HTTP client - #12
Conversation
WalkthroughAdds a changelog entry for v1.5.1 and updates HTTP middleware to map promise rejections via Changes
Sequence DiagramsequenceDiagram
actor Client
participant Middleware as UnexpectedErrorMiddleware
participant Next as next() Promise
participant Otherwise as .otherwise() Handler
Client->>Middleware: handle(request)
Middleware->>Next: call next()
alt Promise resolves
Next-->>Client: response
else Promise rejects or throws
Next-->>Otherwise: rejection (maybe non-Throwable or Throwable)
Otherwise->>Otherwise: if not Throwable -> wrap in Exception('Unknown error.')
Otherwise->>Middleware: throw mapped Throwable
alt AmpExceptionInterface
Middleware-->>Client: rethrow AmpExceptionInterface
else other Throwable
Middleware-->>Client: wrap in UnexpectedErrorException and throw
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧬 Code graph analysis (1)src/Http/Middleware/UnexpectedErrorMiddleware.php (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Pull Request Test Coverage Report for Build 19223117614Details
💛 - Coveralls |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
CHANGELOG.md(1 hunks)src/Http/Middleware/UnexpectedErrorMiddleware.php(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/Http/Middleware/UnexpectedErrorMiddleware.php (1)
src/Exception/UnexpectedErrorException.php (1)
UnexpectedErrorException(10-16)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Unit Tests [PHP 8.3]
- GitHub Check: Php-Cs-Fixer
🔇 Additional comments (2)
CHANGELOG.md (1)
10-12: LGTM! Clear changelog entry.The changelog entry accurately documents the fix and follows the Keep a Changelog format.
src/Http/Middleware/UnexpectedErrorMiddleware.php (1)
8-8: LGTM! Import is necessary.The
Exceptionimport is required for the fallback case in the promise rejection handler where the rejection value might not be aThrowable.
31b360c to
38148c2
Compare
Summary by CodeRabbit