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

Implement SDK error handling #1014

Merged
merged 20 commits into from
Feb 20, 2020

Conversation

nephix
Copy link
Contributor

@nephix nephix commented Feb 12, 2020

Implements #1000 (🎉)

Introduces a new RaidenError class which has an additional code property.

Example usage:

throw new RaidenError(ErrorCodes.PFS_DISALBED, [{ someDetail: 'important infos' }])

In RaidenError the message would be the error message targeted towards developers, while the code would be used display error messages to the user by e.g. hooking it up to i18n.

The new error messages in t he ErrorCodes enum should have a meaningful prefix, e.g. PFS_... for path related things or XFER_... for transfer related things.

The details prop is meant to be used for additional infos related to the error, e.g. transaction IDs or PFS URLs which couldn't be parsed.

@nephix nephix changed the title Initial proposal Implement SDK error handling Feb 12, 2020
@codecov
Copy link

codecov bot commented Feb 12, 2020

Codecov Report

Merging #1014 into master will decrease coverage by 4.56%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1014      +/-   ##
==========================================
- Coverage   96.18%   91.61%   -4.57%     
==========================================
  Files          97       55      -42     
  Lines        3700     1062    -2638     
  Branches      773      118     -655     
==========================================
- Hits         3559      973    -2586     
+ Misses         95       58      -37     
+ Partials       46       31      -15     
Flag Coverage Δ
#dapp 91.61% <ø> (ø) ⬆️
#sdk ?
Impacted Files Coverage Δ
raiden-ts/src/transport/utils.ts
raiden-ts/src/config.ts
raiden-ts/src/utils/matrix.ts
raiden-ts/src/polyfills.ts
raiden-ts/src/channels/actions.ts
raiden-ts/src/utils/ethers.ts
raiden-ts/src/reducer.ts
raiden-ts/src/transport/actions.ts
raiden-ts/src/utils/rx.ts
raiden-ts/src/transfers/actions.ts
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1882aa...2bb8353. Read the comment docs.

Co-Authored-By: André Vitor de Lima Matos <[email protected]>
@nephix nephix force-pushed the feature/sdk-custom-errors branch 3 times, most recently from 76ce4e4 to 35d6e56 Compare February 19, 2020 11:36
@nephix nephix marked this pull request as ready for review February 19, 2020 12:15
Copy link
Contributor

@andrevmatos andrevmatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nephix nephix merged commit d5d245b into raiden-network:master Feb 20, 2020
@nephix nephix deleted the feature/sdk-custom-errors branch February 20, 2020 06:21
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.

2 participants