fix: Branch used does not throw error

This commit is contained in:
Andras Bacsai
2022-02-14 09:57:17 +01:00
parent 77400bbbb0
commit da018a8f2a
3 changed files with 23 additions and 17 deletions

View File

@@ -14,13 +14,11 @@ export const get: RequestHandler = async (event) => {
try {
const found = await db.isBranchAlreadyUsed({ repository, branch, id });
if (found) {
throw {
error: `Branch ${branch} is already used by another application`
};
}
return {
status: 200
status: 200,
body: {
used: found ? true : false
}
};
} catch (error) {
return ErrorHandler(error);