chore(gatekeeper): add specific error for unsupported workspace plan
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
+4
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user