fix: prevent webhook errors to be logged

This commit is contained in:
Andras Bacsai
2022-11-29 14:50:24 +01:00
parent b461635834
commit a55720091c
4 changed files with 23 additions and 19 deletions

View File

@@ -1486,13 +1486,17 @@ export function makeLabelForServices(type) {
}
export function errorHandler({
status = 500,
message = 'Unknown error.'
message = 'Unknown error.',
type = 'normal'
}: {
status: number;
message: string | any;
type?: string | null;
}) {
if (message.message) message = message.message;
Sentry.captureException(message);
if (type === 'normal') {
Sentry.captureException(message);
}
throw { status, message };
}
export async function generateSshKeyPair(): Promise<{ publicKey: string; privateKey: string }> {