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

[Request] Improve error message when DID cannot be resolved #505

Closed
jmcanterafonseca-iota opened this issue Nov 23, 2021 · 1 comment · Fixed by #512
Closed

[Request] Improve error message when DID cannot be resolved #505

jmcanterafonseca-iota opened this issue Nov 23, 2021 · 1 comment · Fixed by #512
Assignees
Labels
Added A new feature that requires a minor release. Part of "Added" section in changelog

Comments

@jmcanterafonseca-iota
Copy link

Bug description

Try to resolve an Identity such as did:iota:dev:DfdEgjf1MQbh23QHAZwRpUtrTknf6BFk4MrXQMv7hQbG on the mainnet

An error such as the one below is raised, not informative nor helpful

Error: Error [ChainError]: Chain Error: Invalid Root Document
    at module.exports.__wbg_new_342a24ca698edd87 (/Users/jmcanterafonseca/work/IOTA/develop/tangle.js/tools/tangle-cli/node_modules/@iota/identity-wasm/node/identity_wasm.js:2884:15)
    at <anonymous>:wasm-function[4054]:0x1ade22
    at <anonymous>:wasm-function[3455]:0x19d68e
    at <anonymous>:wasm-function[1543]:0x13da21
    at <anonymous>:wasm-function[1160]:0x11c421
    at <anonymous>:wasm-function[3096]:0x190fac
    at <anonymous>:wasm-function[2592]:0x17cd4e
    at _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hca1c949258eb7ac8 (<anonymous>:wasm-function[5764]:0x1c886b)
    at __wbg_adapter_32 (/Users/jmcanterafonseca/work/IOTA/develop/tangle.js/tools/tangle-cli/node_modules/@iota/identity-wasm/node/identity_wasm.js:214:10)
    at real (/Users/jmcanterafonseca/work/IOTA/develop/tangle.js/tools/tangle-cli/node_modules/@iota/identity-wasm/node/identity_wasm.js:199:20)

Language version

WASM bindings 0.4.0

Expected behaviour

A controlled error informing that the Identity cannot be resolved

Actual behaviour

A not controlled error that reveals internal working details of the library

@cycraig cycraig added the Added A new feature that requires a minor release. Part of "Added" section in changelog label Nov 23, 2021
@cycraig cycraig changed the title [Bug] When a DID cannot be resolved an uncontrolled error is raised [Request] Improve error message when DID cannot be resolved Nov 23, 2021
@cycraig cycraig self-assigned this Nov 29, 2021
@cycraig
Copy link
Contributor

cycraig commented Nov 29, 2021

The error messages should be more descriptive with the changes in #506 and #512. This should be included in the next release.

Examples:

The common cases are as follows:

  1. From your example, trying to resolve a DID using a Client configured for a different network will now throw the following error:
    Err > DIDNotFound: DID network 'dev' does not match client network 'main'
    
  2. Trying to resolve a non-existent DID or one that has been pruned from the node will throw:
    Err > DIDNotFound: DID not found or pruned
    
  3. Trying to resolve a DID whose root document is invalid, e.g. was not signed correctly or otherwise violates the method specification:
    Err > DIDNotFound: no valid root document found
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Added A new feature that requires a minor release. Part of "Added" section in changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants