Skip to content

Error handling#70

Merged
piotr-iohk merged 9 commits intomainfrom
error_handling
Nov 20, 2024
Merged

Error handling#70
piotr-iohk merged 9 commits intomainfrom
error_handling

Conversation

@piotr-iohk
Copy link
Copy Markdown
Contributor

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
@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