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:
@@ -211,4 +211,11 @@ const main = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
|
try {
|
||||||
main();
|
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)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -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)}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user