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

Error handling #70

Merged
merged 9 commits into from
Nov 20, 2024
Merged

Error handling #70

merged 9 commits into from
Nov 20, 2024

Conversation

piotr-iohk
Copy link
Collaborator

This PR addresses #65 and introduces improved error handling. Errors are now returned in JSON rather then plain text. For instance:

Before:

$ curl -L -X POST 'http://localhost:3000/network/list' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{}' 
GraphQL query failed

After:

$ curl -L -X POST 'http://localhost:3000/network/list' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{}' 
{
  "code": 3,
  "description": "The GraphQL query failed.",
  "details": {
    "error": "Error making HTTP request: error sending request for url (http://localhost:3085/graphql)",
    "extra": "Internal POST to Mina Daemon failed"
  },
  "message": "GraphQL query failed: Error making HTTP request: error sending request for url (http://localhost:3085/graphql)",
  "retriable": true
}

The PR also includes a rather comprehensive test suite to verify error properties.

@piotr-iohk piotr-iohk merged commit 2d9d77c into main Nov 20, 2024
6 checks passed
@piotr-iohk piotr-iohk deleted the error_handling branch November 20, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants