Scheduling infrastructure for absolutely everyone.
fix: better errors for platform (#14987)
Anik Dhabal Babud9806da04902
diff --git a/apps/web/components/settings/platform/pricing/platform-pricing/index.tsx b/apps/web/components/settings/platform/pricing/platform-pricing/index.tsxindex 11514a37621..9e10216e460 100644--- a/apps/web/components/settings/platform/pricing/platform-pricing/index.tsx+++ b/apps/web/components/settings/platform/pricing/platform-pricing/index.tsx@@ -1,5 +1,6 @@import { useRouter } from "next/navigation";+import { ErrorCode } from "@calcom/lib/errorCodes";import { showToast } from "@calcom/ui";import { useSubscribeTeamToStripe } from "@lib/hooks/settings/platform/oauth-clients/usePersistOAuthClient";@@ -16,7 +17,7 @@ export const PlatformPricing = ({ teamId }: PlatformPricingProps) => {router.push(redirectUrl);},onError: () => {- showToast("Internal server error, please try again later", "error");+ showToast(ErrorCode.UnableToSubscribeToThePlatform, "error");},teamId,});diff --git a/apps/web/pages/settings/platform/oauth-clients/[clientId]/edit/index.tsx b/apps/web/pages/settings/platform/oauth-clients/[clientId]/edit/index.tsxindex f5bca779929..5633dc8fc41 100644--- a/apps/web/pages/settings/platform/oauth-clients/[clientId]/edit/index.tsx+++ b/apps/web/pages/settings/platform/oauth-clients/[clientId]/edit/index.tsx@@ -2,6 +2,7 @@ import { useParams } from "next/navigation";import { useRouter } from "next/navigation";import Shell from "@calcom/features/shell/Shell";+import { ErrorCode } from "@calcom/lib/errorCodes";import { PERMISSIONS_GROUPED_MAP } from "@calcom/platform-constants";import { showToast } from "@calcom/ui";@@ -41,7 +42,7 @@ export default function EditOAuthClient() {router.push("/settings/platform/");},onError: () => {- showToast("Internal server error, please try again later", "error");+ showToast(ErrorCode.UpdatingOauthClientError, "error");},clientId,});diff --git a/apps/web/pages/settings/platform/oauth-clients/create.tsx b/apps/web/pages/settings/platform/oauth-clients/create.tsxindex d049c05f1fd..5968be5084d 100644--- a/apps/web/pages/settings/platform/oauth-clients/create.tsx+++ b/apps/web/pages/settings/platform/oauth-clients/create.tsx@@ -1,6 +1,7 @@import { useRouter } from "next/navigation";import Shell from "@calcom/features/shell/Shell";+import { ErrorCode } from "@calcom/lib/errorCodes";import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";import { PERMISSIONS_GROUPED_MAP } from "@calcom/platform-constants/permissions";import { showToast } from "@calcom/ui";@@ -25,7 +26,7 @@ export default function CreateOAuthClient() {router.push("/settings/platform/");},onError: () => {- showToast("Internal server error, please try again later", "error");+ showToast(ErrorCode.CreatingOauthClientError, "error");},});diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex 6d351a0de5e..7ff76a6fd1d 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -2441,5 +2441,8 @@"csat_score": "CSAT Score","lockedSMS": "Locked SMS","signing_up_terms": "By proceeding, you agree to our <1>Terms</1> and <2>Privacy Policy</2>.",+ "unable_to_subscribe_to_the_platform": "An error occurred while trying to subscribe to the platform plan, please try again later",+ "updating_oauth_client_error": "An error occurred while updating the OAuth client, please try again later",+ "creating_oauth_client_error": "An error occurred while creating the OAuth client, please try again later","ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"}diff --git a/packages/lib/errorCodes.ts b/packages/lib/errorCodes.tsindex 3148da15575..8a36c61e5b9 100644--- a/packages/lib/errorCodes.ts+++ b/packages/lib/errorCodes.ts@@ -13,4 +13,7 @@ export enum ErrorCode {NotEnoughAvailableSeats = "not_enough_available_seats_error",AvailabilityNotFoundInSchedule = "availability_not_found_in_schedule_error",CancelledBookingsCannotBeRescheduled = "cancelled_bookings_cannot_be_rescheduled",+ UnableToSubscribeToThePlatform = "unable_to_subscribe_to_the_platform",+ UpdatingOauthClientError = "updating_oauth_client_error",+ CreatingOauthClientError = "creating_oauth_client_error",}