Skip to content

Commit

Permalink
Add descriptive errors
Browse files Browse the repository at this point in the history
Signed-off-by: Andreia Ocanoaia <andreia.ocanoaia@gmail.com>
  • Loading branch information
andreia-oca committed Aug 16, 2023
1 parent 18e2944 commit f0cc61f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core-deployment/src/routes/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ router.post("/", async (req, res) => {

if (!classInfo || !functionsList ) {
return res.status(400).json({
message: "Missing required parameters",
message: "Please complete all the required fields.",
});
}

Expand Down Expand Up @@ -86,6 +86,17 @@ router.post("/", async (req, res) => {
cwd: folderPath,
log: false
}).catch((err: any) => {
if (err.stderr?.includes("You are not logged in or your token is invalid")) {
return res.status(400).json({
message: "It seems your genezio token is invalid. Please generate a new one and try again.",
});
}

if (err.stderr?.includes("You've hit the maximum number of projects.")) {
return res.status(400).json({
message: "You have reached the maximum number of projects allowed. To continue, please upgrade your subscription.",
});
}
console.log("genezio deploy err", err);
return err;
});
Expand All @@ -94,7 +105,7 @@ router.post("/", async (req, res) => {


if (!output.stdout?.includes("Your backend project has been deployed")) {
console.log("CONTINUE WITH NEXT ITERATION");
console.log("[DEBUG] CONTINUE WITH NEXT ITERATION");
continue;
}

Expand Down

0 comments on commit f0cc61f

Please sign in to comment.