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 authored and daviddias committed Mar 14, 2018
1 parent a32dce7 commit aea69d3
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 aea69d3

Please sign in to comment.