-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Summary
The SDK wraps all errors in getKeysFromRelayer (network, JSON, deserialization, etc.) as:
"Impossible to fetch public key: wrong relayer url."
This is misleading and hides the true root cause for callers. In real-world usage, the error often has nothing to do with the relayer URL.
Where
src/relayer/network.ts (or equivalent in build output)
Current behavior (simplified):
try {
// fetch key url, fetch public key, fetch CRS, deserialize
} catch (e) {
throw new Error('Impossible to fetch public key: wrong relayer url.', { cause: e })
}Why this is a problem
- Misleads SDK users (sends them debugging the URL when the issue is deserialization, bytes type mismatch, IO errors, etc.)
- Many environments don’t surface
cause, so the actual error is lost.
Suggested improvements
- Use a neutral message like:
Failed to fetch or deserialize public key
- Or differentiate between error classes:
- network failure vs JSON parsing vs deserialization vs invalid URL
- Surface original message even when wrapped.
Example change
throw new Error('Failed to fetch or deserialize public key', { cause: e });Optional: include an error code or custom error type so SDK users can handle it programmatically.
Happy to provide a PR if desired.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels