replace log by throw (#10167)

as title
This commit is contained in:
martmull
2025-02-12 17:31:41 +01:00
committed by GitHub
parent fb936cccfb
commit b66289c44c
3 changed files with 12 additions and 4 deletions

View File

@ -14,5 +14,6 @@ export enum ServerlessFunctionExceptionCode {
SERVERLESS_FUNCTION_ALREADY_EXIST = 'SERVERLESS_FUNCTION_ALREADY_EXIST',
SERVERLESS_FUNCTION_NOT_READY = 'SERVERLESS_FUNCTION_NOT_READY',
SERVERLESS_FUNCTION_BUILDING = 'SERVERLESS_FUNCTION_BUILDING',
SERVERLESS_FUNCTION_CODE_UNCHANGED = 'SERVERLESS_FUNCTION_CODE_UNCHANGED',
SERVERLESS_FUNCTION_EXECUTION_LIMIT_REACHED = 'SERVERLESS_FUNCTION_EXECUTION_LIMIT_REACHED',
}

View File

@ -193,8 +193,9 @@ export class ServerlessFunctionService {
);
if (deepEqual(latestCode, draftCode)) {
throw new Error(
throw new ServerlessFunctionException(
'Cannot publish a new version when code has not changed',
ServerlessFunctionExceptionCode.SERVERLESS_FUNCTION_CODE_UNCHANGED,
);
}
}

View File

@ -20,6 +20,7 @@ import {
import { getStatusCombinationFromArray } from 'src/modules/workflow/workflow-status/utils/get-status-combination-from-array.util';
import { getStatusCombinationFromUpdate } from 'src/modules/workflow/workflow-status/utils/get-status-combination-from-update.util';
import { getWorkflowStatusesFromCombination } from 'src/modules/workflow/workflow-status/utils/get-statuses-from-combination.util';
import { ServerlessFunctionExceptionCode } from 'src/engine/metadata-modules/serverless-function/serverless-function.exception';
export enum WorkflowVersionEventType {
CREATE = 'CREATE',
@ -174,9 +175,14 @@ export class WorkflowStatusesUpdateJob {
// applied between draft and lastPublished version.
// If no change have been applied, we just use the same
// serverless function version
this.logger.warn(
`Error while publishing serverless function '${step.settings.input.serverlessFunctionId}': ${e}`,
);
if (
e.code !==
ServerlessFunctionExceptionCode.SERVERLESS_FUNCTION_CODE_UNCHANGED
) {
this.logger.error(
`Error while publishing serverless function '${step.settings.input.serverlessFunctionId}': ${e}`,
);
}
}
const serverlessFunction =