saloonphp / saloon

🤠 Build beautiful API integrations and SDKs with Saloon
https://docs.saloon.dev
MIT License
2.09k stars 107 forks source link

Add `PaymentRequired` Exception #441

Closed JonPurvis closed 3 months ago

JonPurvis commented 3 months ago

This PR adds an Exception for 402 Payment Required so rather than it returning a ClientException, it'll now return PaymentRequiredException. I'm working with an API that returns this status code and I'd like to be able to handle these in a certain way, this status also seems to be getting more popular these days, so I think it makes sense for it to now have it's own Exception.

Before Screenshot 2024-07-28 at 23 48 51

After Screenshot 2024-07-28 at 23 48 04

Sister PR to https://github.com/Sammyjo20/saloon-docs/pull/71