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

Feature: Catch exceptions in communicator #182

Merged
merged 3 commits into from
Jun 16, 2021

Conversation

mmv08
Copy link
Member

@mmv08 mmv08 commented Jun 8, 2021

Currently, each method would implement a handler for the error case by itself. This could be moved one layer higher to the communication implementation.

This PR:

  • Moves error handling to the communicator
  • Adds a test case
  • removes error handlers from methods

remember to run lerna run build before merging to generate build files

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2021

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2021

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@mmv08 mmv08 requested review from katspaugh and germartinez June 8, 2021 11:15
this.callbacks.set(request.id, (response: Response<R>) => {
if (!response.success) {
reject(new Error(response.error));
Copy link
Member

Choose a reason for hiding this comment

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

What are some examples of these errors? Maybe we should prefix them with something like "SDK error"?

Copy link
Member Author

Choose a reason for hiding this comment

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

If there's a problem processing app's request on the interface side it will send back a message with success: false. One I can think of a 404 from the server for sdk.txs.getTxBySafeTxHash

@mmv08 mmv08 merged commit 97920f8 into development Jun 16, 2021
@mmv08 mmv08 deleted the feature/catch-exceptions-in-communicator branch June 16, 2021 09:19
@github-actions github-actions bot locked and limited conversation to collaborators Jun 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants