From c2673ec7079fdfc612b32cc98029f656d53f9d23 Mon Sep 17 00:00:00 2001 From: Karthik chakravarthy <88904658+kcheekuri@users.noreply.github.com> Date: Wed, 27 Jul 2022 12:05:56 -0400 Subject: [PATCH] Refactor text messages (#1312) --- src/Contracts/DataModels.ts | 1 + src/Phoenix/PhoenixClient.ts | 31 ++++--------------------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/Contracts/DataModels.ts b/src/Contracts/DataModels.ts index 8bec7e6f9..584f77e77 100644 --- a/src/Contracts/DataModels.ts +++ b/src/Contracts/DataModels.ts @@ -571,4 +571,5 @@ export enum PhoenixErrorType { SubscriptionNotAllowed = "SubscriptionNotAllowed", UnknownError = "UnknownError", PhoenixFlightFallback = "PhoenixFlightFallback", + UserMissingPermissionsError = "UserMissingPermissionsError", } diff --git a/src/Phoenix/PhoenixClient.ts b/src/Phoenix/PhoenixClient.ts index 9ff373366..664e595eb 100644 --- a/src/Phoenix/PhoenixClient.ts +++ b/src/Phoenix/PhoenixClient.ts @@ -19,8 +19,6 @@ import { IContainerData, IDbAccountAllow, IMaxAllocationTimeExceeded, - IMaxDbAccountsPerUserExceeded, - IMaxUsersPerDbAccountExceeded, IPhoenixConnectionInfoResult, IPhoenixError, IProvisionData, @@ -240,34 +238,13 @@ export class PhoenixClient { const maxAllocationTimeExceeded = errInfo as IMaxAllocationTimeExceeded; const allocateAfterTimestamp = new Date(maxAllocationTimeExceeded?.earliestAllocationTimestamp); allocateAfterTimestamp.setDate(allocateAfterTimestamp.getDate() + 1); - return ( - `${errInfo.message}` + - " Max allocation time for a day to a user is " + - `${maxAllocationTimeExceeded.maxAllocationTimePerDayPerUserInMinutes}` + - ". Please try again after " + - `${allocateAfterTimestamp.toLocaleString()}` - ); - } - case PhoenixErrorType.MaxDbAccountsPerUserExceeded: { - const maxDbAccountsPerUserExceeded = errInfo as IMaxDbAccountsPerUserExceeded; - return ( - `${errInfo.message}` + - " Max simultaneous connections allowed per user is " + - `${maxDbAccountsPerUserExceeded.maxSimultaneousConnectionsPerUser}` + - "." - ); - } - case PhoenixErrorType.MaxUsersPerDbAccountExceeded: { - const maxUsersPerDbAccountExceeded = errInfo as IMaxUsersPerDbAccountExceeded; - return ( - `${errInfo.message}` + - " Max simultaneous users allowed per DbAccount is " + - `${maxUsersPerDbAccountExceeded.maxSimultaneousUsersPerDbAccount}` + - "." - ); + return `${errInfo.message}` + ". Please try again after " + `${allocateAfterTimestamp.toLocaleString()}`; } + case PhoenixErrorType.MaxDbAccountsPerUserExceeded: + case PhoenixErrorType.MaxUsersPerDbAccountExceeded: case PhoenixErrorType.AllocationValidationResult: case PhoenixErrorType.RegionNotServicable: + case PhoenixErrorType.UserMissingPermissionsError: case PhoenixErrorType.SubscriptionNotAllowed: { return `${errInfo.message}`; }