-
-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added not found exception #187
base: master
Are you sure you want to change the base?
Conversation
*/ | ||
class NotFoundException extends \Exception implements OmnipayException | ||
{ | ||
public function __construct($message = "Resource not found on payment gateway", $code = 404, $previous = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the code can be just 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to change or 404 is also OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to 0
What do you think about the name. SHould it be more descriptive? @judgej thoughts? |
Can be, it is just a bit longer. Let me know please if I have to change or not. My project is waiting for these updates :) |
Are any of the other exceptions thrown as a result of a specific gateway request error, or does this one stand alone (possibly one of a group of related exceptions)? Just wondering (if I understand correctly) whether exceptions from the remote gateway complaining should be namespaced together, with a generic exception and more detailed exceptions extended by the drivers? |
The original integration was throwing only SDK’s exceptions, currently I have PR overriding only “customer not found” error, to be able to catch and recreate profile instead of showing error to user. In future we can try to morph all errors to Omnipay’s exceptions |
It can throw an InvalidResponse but that's not really specific. |
What's throwing it - Assuming it's the driver, the driver could extend Anyway - just a thought - I'm no expert at structuring exceptions, and a little behind at what PHP 7.2+ is bringing to the exception table. |
@judgej Totally agreed with you, I just suggested to throw this generic Omnipay's exception, to not hardcode Gateway-specific namespaces in multi-gateway application to be able to catch them all |
Changed to ResourceNotFoundException |
Thrown when the requested resource is not found on payment gateway to differentiate from other invalid responses