Skip to content

Commit

Permalink
Improve GitLab API finder error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
0x2b3bfa0 committed May 27, 2021
1 parent 3cbbce0 commit 29b81e9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/drivers/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,19 @@ class Gitlab {
.version
)
return path;
} catch (error) {}
} catch (error) {
return error;
}
})
);

this._detected_base = possible_bases.find(Boolean);
if (!this._detected_base) throw new Error('GitLab API not found');
this._detected_base = possible_bases.find(
(base) => base.constructor !== Error
);
if (!this._detected_base) {
if (possible_bases.length) throw possible_bases[0];
else throw new Error('Invalid repository address');
}

return this._detected_base;
}
Expand Down

1 comment on commit 29b81e9

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

Please sign in to comment.