Ignore any exception from Http facade #43236
Replies: 6 comments 1 reply
-
I dont think it's possible ,nvm |
Beta Was this translation helpful? Give feedback.
-
You have to manually call the throw() method on the Http facade don't you? Http::get('https://example.com')->throw()->object(); Could you not put in the throw method call? |
Beta Was this translation helpful? Give feedback.
-
@bretto36 run this |
Beta Was this translation helpful? Give feedback.
-
using 20 rescure with Http ? No. |
Beta Was this translation helpful? Give feedback.
-
To ignore Http exception I use this: |
Beta Was this translation helpful? Give feedback.
-
Might be happening because of how guzzle exception hierarchy is: https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions Timeout exceptions are not under request. On the question: what about adding a macro method to the Http facade, that makes the request call but is surrounded by a try catch? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I use Http facade in many places in my app, Is there possible to ignore any exception when using it without try catch ? note that it throw exception on ConnectException:
framework/src/Illuminate/Http/Client/PendingRequest.php
Line 809 in 76b407e
Beta Was this translation helpful? Give feedback.
All reactions