Skip to content
This repository was archived by the owner on Aug 24, 2021. It is now read-only.
This repository was archived by the owner on Aug 24, 2021. It is now read-only.

More description error text #46

@KrishnaPG

Description

@KrishnaPG

While using ipfs.dag.get() for a list of CIDs, encountered the below errors on some of them:

Error: invalid base16 character
    at Object.decode ( node_modules\multibase\src\base16.js:14:17)
    at Base.decode ( node_modules\multibase\src\base.js:18:24)
    at Function.decode ( node_modules\multibase\src\index.js:75:27)
    at new CID ( node_modules\cids\src\index.js:79:31)
    at new CID ( node_modules\class-is\index.js:15:17)
    at Function.get.promisify ( node_modules\ipfs\src\core\components\dag.js:94:17)
    at Object.get ( node_modules\promisify-es6\index.js:32:27)

The error is fine, except it is very difficult to identify which exact CID was causing this error (when dealing with multiple CIDs, across multiple asynchronous calls).

Wondering if you would be open to make the errors much descriptive, something like below: at line 14 of base16.js

for (let char of input) {
  if (alphabet.indexOf(char) < 0) {
    throw new Error(`invalid base16 character '${char}' in '${input}'`) //<- more descriptive
  }
}

This helps the callers / users troubleshoot the problems more easily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions