Merged in feature/IO-2924-Refactor-Production-board-to-use-Socket-Provider (pull request #1798)

Add try catch to PBS/CDK and main.
This commit is contained in:
Patrick Fic
2024-09-27 16:25:54 +00:00
3 changed files with 42 additions and 27 deletions

View File

@@ -211,4 +211,11 @@ const main = async () => {
}; };
// Start server // Start server
main(); try {
main();
} catch (error) {
logger.log(`Main-API-Error: Something was not caught in the application.`, "error", "api", null, {
error: error.message,
errorjson: JSON.stringify(error)
});
}

View File

@@ -602,6 +602,7 @@ async function MarkJobExported(socket, jobid) {
} }
async function InsertFailedExportLog(socket, error) { async function InsertFailedExportLog(socket, error) {
try {
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {}); const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
const result = await client const result = await client
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` }) .setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
@@ -616,4 +617,7 @@ async function InsertFailedExportLog(socket, error) {
}); });
return result; return result;
} catch (error2) {
CdkBase.createLogEvent(socket, "ERROR", `Error in InsertFailedExportLog - ${error} - ${JSON.stringify(error2)}`);
}
} }

View File

@@ -986,6 +986,7 @@ async function MarkJobExported(socket, jobid) {
} }
async function InsertFailedExportLog(socket, error) { async function InsertFailedExportLog(socket, error) {
try {
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {}); const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
const result = await client const result = await client
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` }) .setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
@@ -1000,4 +1001,7 @@ async function InsertFailedExportLog(socket, error) {
}); });
return result; return result;
} catch (error2) {
CdkBase.createLogEvent(socket, "ERROR", `Error in InsertFailedExportLog - ${error} - ${JSON.stringify(error2)}`);
}
} }