0xMiden / 0xMiden/web-sdk

Improve rpc error messages for the web client

Open
#105 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1
Forks
21
Avg merge
12h 14m
Merged PRs (30d)
41

Description

When debugging [this error](https://github.com/0xMiden/miden-node/pull/1084#discussion_r2214263659) in the web client, I kept getting the error:
`rpc request failed for get_block_header_by_number: status: Unknown, message: "js api error: TypeError: Failed to fetch", details: [], metadata: MetadataMap { headers: {} }`.

This wasn't much of a help for debugging and meant that I had to add debug logs directly in the node to know what the error case was and why it was happening. The node returns a better error message but it seems it's being discarded. This usually doesn't happen in the rust clients (except for the `Unknown error`s that come from the node) but it seems harder to access the internal response structure because of the use of `tonic_web_wasm_client`.

We should look to improve this specific error message and find a way to propagate the error message returned by the node. This will help devs debug their applications when the node returns specific error messages and will also help internal development of new features.

Contributor guide

Open the contributing guide

Research direction

Look at the web client's RPC error handling, likely in the code using `tonic_web_wasm_client`. Find where the error from the node is being discarded and the generic 'js api error' is generated. The goal is to propagate the underlying node error message. Check the linked PR discussion for context on the specific error case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, typescript
Domain
backend-api-design, devtools, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.