Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 872 Bytes

disable-exception-on-http-error.md

File metadata and controls

29 lines (22 loc) · 872 Bytes

Disable throwing exceptions on HTTP errors

For example you are having configured next client:

eight_points_guzzle:
    clients:
        api_payment:
            base_url: "http://api.domain.tld"

and you are doing request, but exception is thrown in case when API returns, for example, response with code 400. It can be RequestException, ClientException or ServerException, but for some reasons you don't want to catch them. You just want to receive response and to work with it.

It's possible! Just setup http_errors to false:

eight_points_guzzle:
    clients:
        api_payment:
            base_url: "http://api.domain.tld"
            options:
                http_errors: false

Read more about this option in the official Guzzle documentation.