-
Notifications
You must be signed in to change notification settings - Fork 58
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
API: propagate errors to single-response APIs #277
Conversation
filter((message) => message.id === id) | ||
filter((message) => message.id === id), | ||
map((response) => { | ||
if (response.error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason not to leave the response.error
an error instance in https://github.com/aragon/aragon.js/blob/master/packages/aragon-rpc-messenger/src/jsonrpc.js#L19?
It seems like we are converting an error to a string in jsonrpc.js and back to an error here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Primarily because sending an Error
instance through postMessage()
will fail: see things that don't work with the structured clone algorithm.
…entity modification (#686) Coupled with aragon/aragon.js#277, apps will now receive errors on `requestAddressIdentityModification()`.
Fixes aragon/client#734. With aragon/aragon.js#277 we now get the actual errors back from the RPC when a call goes wrong (e.g. naive `token.symbol()` on DAI) and we need to handle these explicitly. This PR converts a lot of the token fallback-related bits into simpler Promise-based code and adds explicit handlers for their error cases.
…th-cache * origin/master: (29 commits) Update README.md (aragon#291) Wrapper: clarify comments about forwarding path finding strategy (aragon#289) Split quick start doc from intro (aragon#287) @aragon/wrapper 5.0.0-rc.2 wrapper: prettify setApp() descriptions (aragon#284) wrapper: fix callsscripts decoding (aragon#283) Wrapper: add installedRepos observable (aragon#268) fix: avoid infinitely looping through forwarders when looking for a transaction path (aragon#285) wrapper: enforce message to sign is string (aragon#282) api: v1.1.0 rpc-messenger: v1.1.0 feat: @aragon/wrapper api cleanup (aragon#279) Wrapper: handle SetApp for updated apps (aragon#267) feat: Add message signing (aragon#276) Wrapper: don't assign initializationBlock on non-kernel proxies when unneeded (aragon#266) chore: ignore package-lock.jsons (aragon#280) API: propagate errors to single-response APIs (aragon#277) Rpc Messenger: dedupe message bus across requests (aragon#278) Fix: changes after review (aragon#274) Docs update: include react api, aragon app architecture & fixes (aragon#271) ...
Fixes aragon/client#734. With aragon/aragon.js#277 we now get the actual errors back from the RPC when a call goes wrong (e.g. naive `token.symbol()` on DAI) and we need to handle these explicitly. This PR converts a lot of the token fallback-related bits into simpler Promise-based code and adds explicit handlers for their error cases.
Fixes aragon/client#734. With aragon/aragon.js#277 we now get the actual errors back from the RPC when a call goes wrong (e.g. naive `token.symbol()` on DAI) and we need to handle these explicitly. This PR converts a lot of the token fallback-related bits into simpler Promise-based code and adds explicit handlers for their error cases.
Fixes aragon/client#734. With aragon/aragon.js#277 we now get the actual errors back from the RPC when a call goes wrong (e.g. naive `token.symbol()` on DAI) and we need to handle these explicitly. This PR converts a lot of the token fallback-related bits into simpler Promise-based code and adds explicit handlers for their error cases.
Now callers of single response APIs will be able to catch errors from the call that are propagated through
@aragon/wrapper
.They can either do this by including an error handler to their
.subscribe()
or by turning the returned observable into a promise and using the standard promise-rejection handling methods.A good example of where this is useful is for transaction signing and message signing, where the user may ultimately reject or cancel the intent.