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

Client getInvoice() is incomplete #286

Description

@dimsav

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions