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

fix: match error if repo doesn't exist #1262

Merged
merged 1 commit into from
Mar 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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