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

Add error HTTP status codes and fix error json marshal #496

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

iansuvak
Copy link
Contributor

@iansuvak iansuvak commented Sep 20, 2024

Why this should be merged

How this works

writeJsonError didn't actually correctly serialize errors since the anonymous struct it was marshalling didn't have exposed fields so it would marshall to an empty struct.

Added status code to distinguish to the caller between user input errors and server side errors. Requests resulting in 5xx level errors can be retried and may succeed in the future while 4xx errors represent malformed or invalid input.

How this was tested

compiled the binary and manually tested against Fuji with common user supplied error cases. Got valid error reponses like:

➜  Code ./sendBadTx.sh
HTTP/1.1 400 Bad Request
Content-Type: application/json
Date: Fri, 20 Sep 2024 14:16:14 GMT
Content-Length: 36

{"error":"Could not decode message"}%

How is this documented

Updated the docs

@iansuvak iansuvak self-assigned this Sep 20, 2024
@iansuvak iansuvak merged commit 2bc6238 into main Sep 20, 2024
8 checks passed
@iansuvak iansuvak deleted the fix_relayer_errors branch September 20, 2024 16:32
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.

3 participants