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
@github-project-automation github-project-automation bot moved this to Backlog in Rafiki 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

@sabineschaller sabineschaller removed this from the Tech Debt milestone Mar 19, 2024
@mkurapov mkurapov moved this from Backlog to Todo in Rafiki Mar 22, 2024
@mkurapov mkurapov self-assigned this Mar 22, 2024
@mkurapov mkurapov moved this from Todo to In Progress in Rafiki Mar 26, 2024
@mkurapov mkurapov linked a pull request Apr 11, 2024 that will close this issue
5 tasks
@github-project-automation github-project-automation bot moved this from In Progress to Done in Rafiki Apr 16, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in Open Payments Apr 16, 2024
@mkurapov mkurapov moved this from Done to In Progress in Rafiki May 7, 2024
@mkurapov
Copy link
Contributor Author

mkurapov commented May 7, 2024

Reopening while I add additional related PRs

@mkurapov mkurapov reopened this May 7, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Backlog in Rafiki May 7, 2024
@mkurapov mkurapov moved this from Backlog to In Progress in Rafiki May 7, 2024
@mkurapov mkurapov moved this from In Progress to Ready for Review in Rafiki May 8, 2024
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Rafiki May 10, 2024
@mkurapov mkurapov moved this from Done to In Progress in Rafiki May 13, 2024
@mkurapov mkurapov reopened this May 13, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Backlog in Rafiki May 13, 2024
@mkurapov mkurapov moved this from Backlog to In Progress in Rafiki May 14, 2024
@mkurapov mkurapov moved this from In Progress to Ready for Review in Rafiki May 14, 2024
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Rafiki May 21, 2024
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