Skip to content
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

Standardize Open Payment errors #1905

Closed
Tracked by #2489
mkurapov opened this issue Sep 19, 2023 · 5 comments · Fixed by #2635, #2705 or #2722
Closed
Tracked by #2489

Standardize Open Payment errors #1905

mkurapov opened this issue Sep 19, 2023 · 5 comments · Fixed by #2635, #2705 or #2722
Assignees
Labels
pkg: auth Changes in the GNAP auth package. pkg: backend Changes in the backend package.

Comments

@mkurapov
Copy link
Contributor

mkurapov commented Sep 19, 2023

We should standardize errors that get thrown in the Open Payments API, so we can return proper error codes and messages in the API response.

Potentially, we could do something like:

class OpenPaymentsError extends Error { 
    constructor(message: string, status: number) {
      super(`Open Payments API error: ${message}`);
      this.name = 'OpenPaymentsError';
      this.status = status
    }
}


throw new OpenPaymentsError('Could not get Incoming Payment', 404); // usage

and then use a middleware to properly format those errors when thrown in the Open Payment routes.
This will also help standardize usage for the Open Payments client: https://github.com/interledger/open-payments/tree/main/packages/open-payments

@mkurapov mkurapov transferred this issue from interledger/open-payments Sep 19, 2023
@mkurapov mkurapov added pkg: backend Changes in the backend package. pkg: auth Changes in the GNAP auth package. labels Sep 19, 2023
@sabineschaller sabineschaller added this to the Tech Debt milestone Oct 3, 2023
@anurag629
Copy link

@sabineschaller Please assign this to me.

@Jacintomuambumba
Copy link

Can you assign this issue to me so I can work on it?

@mkurapov
Copy link
Contributor Author

mkurapov commented Jan 8, 2024

Hey @anurag629 & @Jacintomuambumba, did you end up starting on this issue?

@Jacintomuambumba
Copy link

Iám working

@mkurapov
Copy link
Contributor Author

mkurapov commented May 7, 2024

Reopening while I add additional related PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: auth Changes in the GNAP auth package. pkg: backend Changes in the backend package.
Projects
Status: Done
Status: Done
4 participants