From a3b436abce36788acd01754d8118123e384bb983 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Tue, 13 Mar 2018 17:01:11 -0600 Subject: [PATCH] fix: match error if repo doesnt exist --- src/core/components/repo.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/components/repo.js b/src/core/components/repo.js index dc330aba0e..cf7004559c 100644 --- a/src/core/components/repo.js +++ b/src/core/components/repo.js @@ -19,7 +19,15 @@ module.exports = function repo (self) { version: promisify((callback) => { self._repo._isInitialized(err => { if (err) { - if (/ENOENT|not yet initialized/.test(err.message)) { + // TODO: (dryajov) This is really hacky, there must be a better way + const match = [ + /Key not found in database \[\/version\]/, + /ENOENT/, + /not yet initialized/ + ].some((m) => { + return m.test(err.message) + }) + if (match) { // this repo has not been initialized return callback(null, repoVersion) }