diff --git a/packages/server/modules/gatekeeper/errors/billing.ts b/packages/server/modules/gatekeeper/errors/billing.ts index 0f0a78e03..dc5e5e31a 100644 --- a/packages/server/modules/gatekeeper/errors/billing.ts +++ b/packages/server/modules/gatekeeper/errors/billing.ts @@ -71,3 +71,9 @@ export class InvalidBillingIntervalError extends BaseError { static code = 'INVALID_BILLING_INTERVAL' static statusCode = 400 } + +export class UnsupportedWorkspacePlanError extends BaseError { + static defaultMessage = 'Unsupported workspace plan' + static code = 'UNSUPPORTED_WORKSPACE_PLAN_ERROR' + static statusCode = 400 +} diff --git a/packages/server/modules/gatekeeper/services/subscriptions/upgradeWorkspaceSubscription.ts b/packages/server/modules/gatekeeper/services/subscriptions/upgradeWorkspaceSubscription.ts index 5c4956e12..d9a22dc73 100644 --- a/packages/server/modules/gatekeeper/services/subscriptions/upgradeWorkspaceSubscription.ts +++ b/packages/server/modules/gatekeeper/services/subscriptions/upgradeWorkspaceSubscription.ts @@ -11,6 +11,7 @@ import { import { CountSeatsByTypeInWorkspace } from '@/modules/gatekeeper/domain/operations' import { InvalidWorkspacePlanUpgradeError, + UnsupportedWorkspacePlanError, WorkspaceNotPaidPlanError, WorkspacePlanMismatchError, WorkspacePlanNotFoundError, @@ -265,7 +266,9 @@ export const upgradeWorkspaceSubscriptionFactoryNew = if (!workspacePlan) throw new WorkspacePlanNotFoundError() if (!isNewPlanType(workspacePlan.name) || !isNewPlanType(targetPlan)) { - throw new NotImplementedError() + throw new UnsupportedWorkspacePlanError(null, { + info: { currentPlan: workspacePlan.name, targetPlan } + }) } switch (workspacePlan.name) {