Define server error messages to display in FE from the server (#12973)
Currently, when a server query or mutation from the front-end fails, the error message defined server-side is displayed in a snackbar in the front-end. These error messages usually contain technical details that don't belong to the user interface, such as "ObjectMetadataCollection not found" or "invalid ENUM value for ...". **BE** In addition to the original error message that is still needed (for the request response, debugging, sentry monitoring etc.), we add a `displayedErrorMessage` that will be used in the snackbars. It's only relevant to add it for the messages that will reach the FE (ie. not in jobs or in rest api for instance) and if it can help the user sort out / fix things (ie. we do add displayedErrorMessage for "Cannot create multiple draft versions for the same workflow" or "Cannot delete [field], please update the label identifier field first", but not "Object metadata does not exist"), even if in practice in the FE users should not be able to perform an action that will not work (ie should not be able to save creation of multiple draft versions of the same workflows). **FE** To ease the usage we replaced enqueueSnackBar with enqueueErrorSnackBar and enqueueSuccessSnackBar with an api that only requires to pass on the error. If no displayedErrorMessage is specified then the default error message is `An error occured.`
This commit is contained in:
+6
-2
@@ -1,8 +1,12 @@
|
||||
import { CustomException } from 'src/utils/custom-exception';
|
||||
|
||||
export class WorkflowQueryValidationException extends CustomException {
|
||||
constructor(message: string, code: WorkflowQueryValidationExceptionCode) {
|
||||
super(message, code);
|
||||
constructor(
|
||||
message: string,
|
||||
code: WorkflowQueryValidationExceptionCode,
|
||||
{ userFriendlyMessage }: { userFriendlyMessage?: string } = {},
|
||||
) {
|
||||
super(message, code, userFriendlyMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -1,8 +1,12 @@
|
||||
import { CustomException } from 'src/utils/custom-exception';
|
||||
|
||||
export class WorkflowVersionStepException extends CustomException {
|
||||
constructor(message: string, code: WorkflowVersionStepExceptionCode) {
|
||||
super(message, code);
|
||||
constructor(
|
||||
message: string,
|
||||
code: WorkflowVersionStepExceptionCode,
|
||||
{ userFriendlyMessage }: { userFriendlyMessage?: string } = {},
|
||||
) {
|
||||
super(message, code, userFriendlyMessage);
|
||||
}
|
||||
}
|
||||
export enum WorkflowVersionStepExceptionCode {
|
||||
|
||||
+5
@@ -1,3 +1,5 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
|
||||
import {
|
||||
WorkflowQueryValidationException,
|
||||
WorkflowQueryValidationExceptionCode,
|
||||
@@ -11,6 +13,9 @@ export const assertWorkflowStatusesNotSet = (
|
||||
throw new WorkflowQueryValidationException(
|
||||
'Statuses cannot be set manually.',
|
||||
WorkflowQueryValidationExceptionCode.FORBIDDEN,
|
||||
{
|
||||
userFriendlyMessage: t`Statuses cannot be set manually.`,
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
+5
@@ -1,3 +1,5 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
|
||||
import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity';
|
||||
import { WorkflowAction } from 'src/modules/workflow/workflow-executor/workflow-actions/types/workflow-action.type';
|
||||
import {
|
||||
@@ -14,6 +16,9 @@ export function assertWorkflowVersionHasSteps(
|
||||
throw new WorkflowTriggerException(
|
||||
'Workflow version does not contain at least one step',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_VERSION,
|
||||
{
|
||||
userFriendlyMessage: t`Workflow version does not contain at least one step`,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -1,3 +1,5 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
|
||||
import {
|
||||
WorkflowQueryValidationException,
|
||||
WorkflowQueryValidationExceptionCode,
|
||||
@@ -14,6 +16,9 @@ export const assertWorkflowVersionIsDraft = (
|
||||
throw new WorkflowQueryValidationException(
|
||||
'Workflow version is not in draft status',
|
||||
WorkflowQueryValidationExceptionCode.FORBIDDEN,
|
||||
{
|
||||
userFriendlyMessage: t`Workflow version is not in draft status`,
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
+5
@@ -1,3 +1,5 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
|
||||
import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity';
|
||||
import {
|
||||
WorkflowTriggerException,
|
||||
@@ -17,6 +19,9 @@ export function assertWorkflowVersionTriggerIsDefined(
|
||||
throw new WorkflowTriggerException(
|
||||
'Workflow version does not contain trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_VERSION,
|
||||
{
|
||||
userFriendlyMessage: t`Workflow version does not contain trigger`,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -1,5 +1,6 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { IsNull, Not } from 'typeorm';
|
||||
|
||||
import {
|
||||
@@ -38,6 +39,9 @@ export class WorkflowVersionValidationWorkspaceService {
|
||||
throw new WorkflowQueryValidationException(
|
||||
'Cannot create workflow version with status other than draft',
|
||||
WorkflowQueryValidationExceptionCode.FORBIDDEN,
|
||||
{
|
||||
userFriendlyMessage: t`Cannot create workflow version with status other than draft`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -62,6 +66,9 @@ export class WorkflowVersionValidationWorkspaceService {
|
||||
throw new WorkflowQueryValidationException(
|
||||
'Cannot create multiple draft versions for the same workflow',
|
||||
WorkflowQueryValidationExceptionCode.FORBIDDEN,
|
||||
{
|
||||
userFriendlyMessage: t`Cannot create multiple draft versions for the same workflow`,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -89,6 +96,9 @@ export class WorkflowVersionValidationWorkspaceService {
|
||||
throw new WorkflowQueryValidationException(
|
||||
'Cannot update workflow version status manually',
|
||||
WorkflowQueryValidationExceptionCode.FORBIDDEN,
|
||||
{
|
||||
userFriendlyMessage: t`Cannot update workflow version status manually`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -132,6 +142,9 @@ export class WorkflowVersionValidationWorkspaceService {
|
||||
throw new WorkflowQueryValidationException(
|
||||
'The initial version of a workflow can not be deleted',
|
||||
WorkflowQueryValidationExceptionCode.FORBIDDEN,
|
||||
{
|
||||
userFriendlyMessage: t`The initial version of a workflow can not be deleted`,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { isDefined, isValidUuid } from 'twenty-shared/utils';
|
||||
import { Repository } from 'typeorm';
|
||||
@@ -312,6 +313,9 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
throw new WorkflowVersionStepException(
|
||||
'Step is not a form',
|
||||
WorkflowVersionStepExceptionCode.INVALID,
|
||||
{
|
||||
userFriendlyMessage: t`Step is not a form`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -1,8 +1,12 @@
|
||||
import { CustomException } from 'src/utils/custom-exception';
|
||||
|
||||
export class WorkflowStepExecutorException extends CustomException {
|
||||
constructor(message: string, code: WorkflowStepExecutorExceptionCode) {
|
||||
super(message, code);
|
||||
constructor(
|
||||
message: string,
|
||||
code: WorkflowStepExecutorExceptionCode,
|
||||
{ userFriendlyMessage }: { userFriendlyMessage?: string } = {},
|
||||
) {
|
||||
super(message, code, userFriendlyMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
|
||||
import {
|
||||
WorkflowStepExecutorException,
|
||||
WorkflowStepExecutorExceptionCode,
|
||||
} from 'src/modules/workflow/workflow-executor/exceptions/workflow-step-executor.exception';
|
||||
import { WorkflowAction } from 'src/modules/workflow/workflow-executor/workflow-actions/types/workflow-action.type';
|
||||
|
||||
export const getPreviousStepOutput = (
|
||||
steps: WorkflowAction[],
|
||||
currentStepId: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
context: Record<string, any>,
|
||||
) => {
|
||||
const previousSteps = steps.filter((step) =>
|
||||
step?.nextStepIds?.includes(currentStepId),
|
||||
);
|
||||
|
||||
if (previousSteps.length === 0) {
|
||||
throw new WorkflowStepExecutorException(
|
||||
'Filter action must have a previous step',
|
||||
WorkflowStepExecutorExceptionCode.FAILED_TO_EXECUTE_STEP,
|
||||
{
|
||||
userFriendlyMessage: t`Filter action must have a previous step`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
if (previousSteps.length > 1) {
|
||||
throw new WorkflowStepExecutorException(
|
||||
'Filter action must have only one previous step',
|
||||
WorkflowStepExecutorExceptionCode.FAILED_TO_EXECUTE_STEP,
|
||||
{
|
||||
userFriendlyMessage: t`Filter action must have only one previous step`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const previousStep = previousSteps[0];
|
||||
const previousStepOutput = context[previousStep.id];
|
||||
|
||||
if (!previousStepOutput) {
|
||||
throw new WorkflowStepExecutorException(
|
||||
'Previous step output not found',
|
||||
WorkflowStepExecutorExceptionCode.FAILED_TO_EXECUTE_STEP,
|
||||
);
|
||||
}
|
||||
|
||||
return previousStepOutput;
|
||||
};
|
||||
+6
-2
@@ -2,8 +2,12 @@ import { CustomException } from 'src/utils/custom-exception';
|
||||
|
||||
export class WorkflowTriggerException extends CustomException {
|
||||
declare code: WorkflowTriggerExceptionCode;
|
||||
constructor(message: string, code: WorkflowTriggerExceptionCode) {
|
||||
super(message, code);
|
||||
constructor(
|
||||
message: string,
|
||||
code: WorkflowTriggerExceptionCode,
|
||||
{ userFriendlyMessage }: { userFriendlyMessage?: string } = {},
|
||||
) {
|
||||
super(message, code, userFriendlyMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
@@ -1,3 +1,4 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
|
||||
import { WorkflowFormActionSettings } from 'src/modules/workflow/workflow-executor/workflow-actions/form/types/workflow-form-action-settings.type';
|
||||
@@ -11,6 +12,9 @@ export function assertFormStepIsValid(settings: WorkflowFormActionSettings) {
|
||||
throw new WorkflowTriggerException(
|
||||
'No input provided in form step',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`No input provided in form step`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,6 +22,9 @@ export function assertFormStepIsValid(settings: WorkflowFormActionSettings) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Form action must have at least one field',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_VERSION,
|
||||
{
|
||||
userFriendlyMessage: t`Form action must have at least one field`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,6 +36,9 @@ export function assertFormStepIsValid(settings: WorkflowFormActionSettings) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Form action fields must have unique names',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_VERSION,
|
||||
{
|
||||
userFriendlyMessage: t`Form action fields must have unique names`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,6 +51,9 @@ export function assertFormStepIsValid(settings: WorkflowFormActionSettings) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Form action fields must have a defined label and type',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_VERSION,
|
||||
{
|
||||
userFriendlyMessage: t`Form action fields must have a defined label and type`,
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
+56
@@ -1,3 +1,5 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
|
||||
import {
|
||||
WorkflowVersionStatus,
|
||||
WorkflowVersionWorkspaceEntity,
|
||||
@@ -33,6 +35,9 @@ export function assertVersionCanBeActivated(
|
||||
throw new WorkflowTriggerException(
|
||||
'Cannot activate non-draft or non-last-published version',
|
||||
WorkflowTriggerExceptionCode.INVALID_INPUT,
|
||||
{
|
||||
userFriendlyMessage: t`Cannot activate non-draft or non-last-published version`,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -42,6 +47,9 @@ function assertVersionIsValid(workflowVersion: WorkflowVersionWorkspaceEntity) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Workflow version does not contain trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_VERSION,
|
||||
{
|
||||
userFriendlyMessage: t`Workflow version does not contain trigger`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,6 +57,9 @@ function assertVersionIsValid(workflowVersion: WorkflowVersionWorkspaceEntity) {
|
||||
throw new WorkflowTriggerException(
|
||||
'No trigger type provided',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`No trigger type provided`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,6 +67,9 @@ function assertVersionIsValid(workflowVersion: WorkflowVersionWorkspaceEntity) {
|
||||
throw new WorkflowTriggerException(
|
||||
'No steps provided in workflow version',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`No steps provided in workflow version`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -88,6 +102,9 @@ function assertTriggerSettingsAreValid(
|
||||
throw new WorkflowTriggerException(
|
||||
'Invalid trigger type for enabling workflow trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid trigger type for enabling workflow trigger`,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -98,6 +115,9 @@ function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
throw new WorkflowTriggerException(
|
||||
'No setting type provided in cron trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`No setting type provided in cron trigger`,
|
||||
},
|
||||
);
|
||||
}
|
||||
switch (settings.type) {
|
||||
@@ -106,6 +126,9 @@ function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
throw new WorkflowTriggerException(
|
||||
'No pattern provided in CUSTOM cron trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`No pattern provided in CUSTOM cron trigger`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -117,24 +140,36 @@ function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
throw new WorkflowTriggerException(
|
||||
'No schedule provided in cron trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`No schedule provided in cron trigger`,
|
||||
},
|
||||
);
|
||||
}
|
||||
if (settings.schedule.day <= 0) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Invalid day value. Should be integer greater than 1',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid day value. Should be integer greater than 1`,
|
||||
},
|
||||
);
|
||||
}
|
||||
if (settings.schedule.hour < 0 || settings.schedule.hour > 23) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Invalid hour value. Should be integer between 0 and 23',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid hour value. Should be integer between 0 and 23`,
|
||||
},
|
||||
);
|
||||
}
|
||||
if (settings.schedule.minute < 0 || settings.schedule.minute > 59) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Invalid minute value. Should be integer between 0 and 59',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid minute value. Should be integer between 0 and 59`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -146,12 +181,18 @@ function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
throw new WorkflowTriggerException(
|
||||
'No schedule provided in cron trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid hour value. Should be integer greater than 1`,
|
||||
},
|
||||
);
|
||||
}
|
||||
if (settings.schedule.hour <= 0) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Invalid hour value. Should be integer greater than 1',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid hour value. Should be integer greater than 1`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -159,6 +200,9 @@ function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Invalid minute value. Should be integer between 0 and 59',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid minute value. Should be integer between 0 and 59`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -170,6 +214,9 @@ function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
throw new WorkflowTriggerException(
|
||||
'No schedule provided in cron trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid minute value. Should be integer greater than 1`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -177,6 +224,9 @@ function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Invalid minute value. Should be integer greater than 1',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid minute value. Should be integer greater than 1`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -187,6 +237,9 @@ function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
throw new WorkflowTriggerException(
|
||||
'Invalid setting type provided in cron trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Invalid setting type provided in cron trigger`,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -197,6 +250,9 @@ function assertDatabaseEventTriggerSettingsAreValid(settings: any) {
|
||||
throw new WorkflowTriggerException(
|
||||
'No event name provided in database event trigger',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`No event name provided in database event trigger`,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-1
@@ -1,10 +1,11 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import cron from 'cron-validate';
|
||||
|
||||
import { WorkflowCronTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type';
|
||||
import {
|
||||
WorkflowTriggerException,
|
||||
WorkflowTriggerExceptionCode,
|
||||
} from 'src/modules/workflow/workflow-trigger/exceptions/workflow-trigger.exception';
|
||||
import { WorkflowCronTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type';
|
||||
|
||||
const validatePattern = (pattern: string) => {
|
||||
const cronValidator = cron(pattern);
|
||||
@@ -13,6 +14,9 @@ const validatePattern = (pattern: string) => {
|
||||
throw new WorkflowTriggerException(
|
||||
`Cron pattern '${pattern}' is invalid`,
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Cron pattern '${pattern}' is invalid`,
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -51,6 +55,9 @@ export const computeCronPatternFromSchedule = (
|
||||
throw new WorkflowTriggerException(
|
||||
'Unsupported cron schedule type',
|
||||
WorkflowTriggerExceptionCode.INVALID_WORKFLOW_TRIGGER,
|
||||
{
|
||||
userFriendlyMessage: t`Unsupported cron schedule type`,
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
+7
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import { DatabaseEventAction } from 'src/engine/api/graphql/graphql-query-runner/enums/database-event-action';
|
||||
@@ -269,6 +270,9 @@ export class WorkflowTriggerWorkspaceService {
|
||||
throw new WorkflowTriggerException(
|
||||
'Cannot have more than one active workflow version',
|
||||
WorkflowTriggerExceptionCode.FORBIDDEN,
|
||||
{
|
||||
userFriendlyMessage: t`Cannot have more than one active workflow version`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -294,6 +298,9 @@ export class WorkflowTriggerWorkspaceService {
|
||||
throw new WorkflowTriggerException(
|
||||
'Cannot disable non-active workflow version',
|
||||
WorkflowTriggerExceptionCode.FORBIDDEN,
|
||||
{
|
||||
userFriendlyMessage: t`Cannot disable non-active workflow version`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user