Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Client getInvoice() is incomplete #286

Open
dimsav opened this issue Nov 10, 2018 · 0 comments
Open

Client getInvoice() is incomplete #286

dimsav opened this issue Nov 10, 2018 · 0 comments

Comments

@dimsav
Copy link

dimsav commented Nov 10, 2018

Hello,

it seems that when we attempt to fetch an invoice by using an invalid id, the client throws a generic exception.

This causes the following problem:

If we try to fetch an invoice from your api, it's not clear what the error code is. Is it a 404 because the id is invalid? Or maybe a 503 because your service is temporarily down? Or something other like an authentication issue?

All these open question marks are impossible to be handled properly with this implementation. On the other hand, our code needs to take care of each case: retry later if your api is down, or do not bother if the invoice is not found, or send an email to admins if there is an authentication issue.

My suggestion is respond using different specific exception classes for each case, or maybe simply pass the http error code to the exception. In any case, the exception returned should not be the generic \Exception to make sure we catch other exceptions thrown somewhere else.

Thank you for your time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant