This repository has been archived by the owner on Sep 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove direct access to codec lookup table
Use `getCodeVarint()` instead of directly accessing the lookup table of the multicodec module. This leads to nicer error messages if the given codec is not found. Prior to this commit: buffer.js:183 throw new TypeError(kFromErrorMsg); ^ TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. at Function.Buffer.from (buffer.js:183:11) at CID.get buffer [as buffer] (/home/vmx/src/pl/js-cid/src/index.js:123:18) at CID.toBaseEncodedString (/home/vmx/src/pl/js-cid/src/index.js:184:44) at Object.<anonymous> (/home/vmx/src/pl/js-cid/keccak.js:16:19) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Function.Module.runMain (module.js:693:10) With this commit: /home/vmx/src/pl/js-multicodec/src/index.js:73 throw new Error('Codec `' + codecName + '` not found') ^ Error: Codec `mycodec` not found at Object.exports.getCodeVarint (/home/vmx/src/pl/js-multicodec/src/index.js:73:11) at CID.get buffer [as buffer] (/home/vmx/src/pl/js-cid/src/index.js:121:38) at CID.toBaseEncodedString (/home/vmx/src/pl/js-cid/src/index.js:186:44) at Object.<anonymous> (/home/vmx/src/pl/js-cid/keccak.js:16:19) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Function.Module.runMain (module.js:693:10)
- Loading branch information