Clean step and edge errors (#14261)
- add filters for both resolvers - map to gql errors Should fix https://github.com/twentyhq/core-team-issues/issues/996
This commit is contained in:
-1
@@ -3,6 +3,5 @@ import { CustomException } from 'src/utils/custom-exception';
|
||||
export class WorkflowVersionEdgeException extends CustomException<WorkflowVersionEdgeExceptionCode> {}
|
||||
|
||||
export enum WorkflowVersionEdgeExceptionCode {
|
||||
UNKNOWN = 'UNKNOWN',
|
||||
NOT_FOUND = 'NOT_FOUND',
|
||||
}
|
||||
|
||||
+2
-4
@@ -3,9 +3,7 @@ import { CustomException } from 'src/utils/custom-exception';
|
||||
export class WorkflowVersionStepException extends CustomException<WorkflowVersionStepExceptionCode> {}
|
||||
|
||||
export enum WorkflowVersionStepExceptionCode {
|
||||
UNKNOWN = 'UNKNOWN',
|
||||
INVALID_REQUEST = 'INVALID_REQUEST',
|
||||
NOT_FOUND = 'NOT_FOUND',
|
||||
UNDEFINED = 'UNDEFINED',
|
||||
FAILURE = 'FAILURE',
|
||||
INVALID = 'INVALID',
|
||||
CODE_STEP_FAILURE = 'CODE_STEP_FAILURE',
|
||||
}
|
||||
|
||||
+5
-5
@@ -164,7 +164,7 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
if (!isDefined(workflowVersion.steps)) {
|
||||
throw new WorkflowVersionStepException(
|
||||
"Can't update step from undefined steps",
|
||||
WorkflowVersionStepExceptionCode.UNDEFINED,
|
||||
WorkflowVersionStepExceptionCode.INVALID_REQUEST,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
if (!isDeletingTrigger && !isDefined(workflowVersion.steps)) {
|
||||
throw new WorkflowVersionStepException(
|
||||
"Can't delete step from undefined steps",
|
||||
WorkflowVersionStepExceptionCode.UNDEFINED,
|
||||
WorkflowVersionStepExceptionCode.INVALID_REQUEST,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
if (step.type !== WorkflowActionType.FORM) {
|
||||
throw new WorkflowVersionStepException(
|
||||
'Step is not a form',
|
||||
WorkflowVersionStepExceptionCode.INVALID,
|
||||
WorkflowVersionStepExceptionCode.INVALID_REQUEST,
|
||||
{
|
||||
userFriendlyMessage: t`Step is not a form`,
|
||||
},
|
||||
@@ -478,7 +478,7 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
if (!isDefined(newServerlessFunction)) {
|
||||
throw new WorkflowVersionStepException(
|
||||
'Fail to create Code Step',
|
||||
WorkflowVersionStepExceptionCode.FAILURE,
|
||||
WorkflowVersionStepExceptionCode.CODE_STEP_FAILURE,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
default:
|
||||
throw new WorkflowVersionStepException(
|
||||
`WorkflowActionType '${type}' unknown`,
|
||||
WorkflowVersionStepExceptionCode.UNKNOWN,
|
||||
WorkflowVersionStepExceptionCode.INVALID_REQUEST,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user