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

Commit

Permalink
perf: fail fast for missing format
Browse files Browse the repository at this point in the history
No need to get the block if we're not going to be able to resolve a path within it.

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
alanshaw authored and vmx committed Nov 7, 2018
1 parent 0c78f0e commit ebd2d1b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,19 @@ class IPLDResolver {

doUntil(
(cb) => {
const r = this.resolvers[cid.codec]

if (!r) {
return cb(new Error('No resolver found for codec "' + cid.codec + '"'))
}

// get block
// use local resolver
// update path value
this.bs.get(cid, (err, block) => {
if (err) {
return cb(err)
}
const r = this.resolvers[cid.codec]
if (!r) {
return cb(new Error('No resolver found for codec "' + cid.codec + '"'))
}
r.resolver.resolve(block.data, path, (err, result) => {
if (err) {
return cb(err)
Expand Down

0 comments on commit ebd2d1b

Please sign in to comment.