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

API: propagate errors to single-response APIs #277

Merged
merged 5 commits into from Apr 9, 2019

Conversation

Projects
None yet
2 participants
@sohkai
Copy link
Member

sohkai commented Apr 8, 2019

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.

sohkai added some commits Apr 8, 2019

@sohkai sohkai requested a review from 2color Apr 8, 2019

sohkai added some commits Apr 8, 2019

filter((message) => message.id === id)
filter((message) => message.id === id),
map((response) => {
if (response.error) {

This comment has been minimized.

Copy link
@2color

2color Apr 9, 2019

Contributor

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.

This comment has been minimized.

Copy link
@sohkai

sohkai Apr 9, 2019

Author Member

Primarily because sending an Error instance through postMessage() will fail: see things that don't work with the structured clone algorithm.

@sohkai sohkai referenced this pull request Apr 9, 2019

Merged

feat: Add message signing #276

1 of 1 task complete

@2color 2color self-requested a review Apr 9, 2019

@2color

2color approved these changes Apr 9, 2019

@sohkai sohkai merged commit 4914b59 into master Apr 9, 2019

4 checks passed

License Compliance All checks passed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@sohkai sohkai deleted the api-propagate-error branch Apr 9, 2019

sohkai added a commit to aragon/aragon that referenced this pull request Apr 10, 2019

Identity Provider: provide response to aragonAPI when user cancels id…
…entity modification (#686)

Coupled with aragon/aragon.js#277, apps will now receive errors on `requestAddressIdentityModification()`.

sohkai added a commit to aragon/aragon-apps that referenced this pull request Apr 18, 2019

Finance: fix token fallbacks and error handling (#813)
Fixes aragon/aragon#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.