Skip to content

Commit

Permalink
Check if terminusdb is reachable on startup and exit if not
Browse files Browse the repository at this point in the history
  • Loading branch information
matko committed Nov 9, 2023
1 parent 879ceaa commit 52b2615
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,20 @@ app.listen(3035, async () => {
);
console.log("The Change Request team has been created");
} catch (err: any) {
if (
if (err.data === undefined) {
// terminusdb has not yet started up. exit.
console.error("TerminusDB not yet initialized");
process.exit(1);
} else if (
typeof err.data === "object" &&
err.data["api:error"] &&
err.data["api:error"]["@type"] === "api:NoUniqueIdForOrganizationName"
) {
console.log("The Change Request team already exists");
} else {
console.log("An unexpected error occured during startup");
console.log(err);
process.exit(1);
}
}
});
Expand Down

0 comments on commit 52b2615

Please sign in to comment.