Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: match error if repo doesnt exist (#1262)
Browse files Browse the repository at this point in the history
  • Loading branch information
dryajov committed Mar 14, 2018
1 parent 0ff92af commit c2db1da
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/components/repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit c2db1da

Please sign in to comment.