Skip to content

Commit 28adf67

Browse files
committed
Fix exception
1 parent 96eaaf3 commit 28adf67

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.exception.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ export enum ServerlessFunctionExceptionCode {
1111
SERVERLESS_FUNCTION_CODE_UNCHANGED = 'SERVERLESS_FUNCTION_CODE_UNCHANGED',
1212
SERVERLESS_FUNCTION_EXECUTION_LIMIT_REACHED = 'SERVERLESS_FUNCTION_EXECUTION_LIMIT_REACHED',
1313
SERVERLESS_FUNCTION_CREATE_FAILED = 'SERVERLESS_FUNCTION_CREATE_FAILED',
14+
SERVERLESS_FUNCTION_EXECUTION_TIMEOUT = 'SERVERLESS_FUNCTION_EXECUTION_TIMEOUT',
1415
}

packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,13 @@ export class ServerlessFunctionService {
482482

483483
const timeoutPromise = new Promise<never>((_, reject) => {
484484
timeoutId = setTimeout(
485-
() => reject(new Error(`Execution timeout: ${timeoutMs / 1000}s`)),
485+
() =>
486+
reject(
487+
new ServerlessFunctionException(
488+
`Execution timeout: ${timeoutMs / 1000}s`,
489+
ServerlessFunctionExceptionCode.SERVERLESS_FUNCTION_EXECUTION_TIMEOUT,
490+
),
491+
),
486492
timeoutMs,
487493
);
488494
});

0 commit comments

Comments
 (0)