-
Notifications
You must be signed in to change notification settings - Fork 111
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
Clarify how to recognize different error types in from LPI #302
Comments
Can this be closed now that we're switching to LPIv2? |
It seems ILP v2 uses a mix of thrown errors and Promise rejections? And the PR description says "Clarify that errors should be distinguished by name", but I can't find that text, can you point to a line number? |
Github closed this. |
michielbdejong
pushed a commit
that referenced
this issue
Jan 20, 2018
michielbdejong
pushed a commit
that referenced
this issue
Mar 2, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The way ilp-connector knows that a plugin throws one of https://github.com/interledger/rfcs/blob/master/0004-ledger-plugin-interface/0004-ledger-plugin-interface.md#errors is not by using
instanceof
because that would require shared JavaScript code between the plugin and the code that uses the plugin, or it would require the plugin to expose these error classes as constants. Instead, it looks aterr.name
.I think it may be clear from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name that an error object should have a
.name
field with its name, but if you look at for instance https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch and also how it's usually done in Java, C++, C#, etc. I think it doesn't hurt to add a sentence 'when catching an error, look for the.name
field, which will then be the string from the left column in the table (case-sensitive)'The text was updated successfully, but these errors were encountered: