Skip to content

Commit 755b5c6

Browse files
hugomrdiasdaviddias
authored andcommitted
feat: add uniform error to isInitialized
_isInitialized is used in several other repos to check the repo even being a pseudo private method the error should be uniform for easier handling and not whatever this.config.exists(cb) or this.version.check(repoVersion, cb) returns on error
1 parent 7bb4c41 commit 755b5c6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ class IpfsRepo {
213213
(err, res) => {
214214
log('init', err, res)
215215
if (err) {
216-
return callback(err)
217-
}
218-
219-
if (!res.config) {
220-
return callback(new Error('repo is not initialized yet'))
216+
return callback(Object.assign(new Error('repo is not initialized yet'),
217+
{
218+
code: 'ERR_REPO_NOT_INITIALIZED',
219+
path: this.path
220+
}))
221221
}
222222
callback()
223223
}

0 commit comments

Comments
 (0)