fre5h / CentrifugoBundle

📦 Provides communication with web-socket server Centrifugo in Symfony applications.
https://centrifugal.github.io/centrifugo/
MIT License
78 stars 8 forks source link

Add http response to CentrifugoException #36

Closed rela589n closed 7 months ago

rela589n commented 7 months ago

Hi there!

In some cases client code would like to catch CentrifugoException and find out what's actually gone wrong. For instance, when assertValidResponseStatusCode throws exception, it just gives an error message and it's hard to find out the root cause or to log anything, since there's not that much context. Also, if trying to rely on symfony http client, AFAIK it doesn't log the actual responses, but writes just uri sting and response status code instead.

Therefore, this PR adds ResponseInterface $response property to CentrifugoException so that it may be caught by the client code and alalyzed somehow (for instance, logged).

Please, let me know what you think on this matter

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (410067f) 100.00% compared to head (1a0091d) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #36 +/- ## =========================================== Coverage 100.00% 100.00% - Complexity 403 406 +3 =========================================== Files 71 72 +1 Lines 1308 1316 +8 =========================================== + Hits 1308 1316 +8 ``` | [Flag](https://app.codecov.io/gh/fre5h/CentrifugoBundle/pull/36/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Artem+Henvald) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/fre5h/CentrifugoBundle/pull/36/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Artem+Henvald) | `100.00% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Artem+Henvald#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

rela589n commented 7 months ago

@fre5h , Done

fre5h commented 7 months ago

@rela589n https://github.com/fre5h/CentrifugoBundle/releases/tag/5.1.0