fix: better errors for platform (#14987)

## What does this PR do?

<!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. -->

- Fixes #14977 

<!-- Please provide a loom video for visual changes to speed up reviews
 Loom Video: https://www.loom.com/
-->

## Mandatory Tasks (DO NOT REMOVE)

- [ ] I have self-reviewed the code (A decent size PR without self-review might be rejected)
- [ ] I have added a Docs issue [here](https://github.com/calcom/docs/issues/new) if this PR makes changes that would require a [documentation change](https://docs.cal.com)
- [ ] I have added or modified automated tests that prove my fix is effective or that my feature works (PRs might be rejected if logical changes are not properly tested)

## How should this be tested?

<!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. Write details that help to start the tests -->

- Are there environment variables that should be set?
- What are the minimal test data to have?
- What is expected (happy path) to have (input and output)?
- Any other important info that could help to test that PR

## Checklist

<!-- Remove bullet points below that don't apply to you -->

- I haven't read the [contributing guide](https://github.com/calcom/cal.com/blob/main/CONTRIBUTING.md)
- My code doesn't follow the style guidelines of this project
- I haven't commented my code, particularly in hard-to-understand areas
- I haven't checked if my changes generate no new warnings
This commit is contained in:
Anik Dhabal Babu
2024-05-14 11:56:44 -07:00
committed by GitHub
parent 42fc49488d
commit d9806da049
5 changed files with 12 additions and 3 deletions
@@ -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,
});
@@ -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,
});
@@ -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");
},
});
@@ -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 ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
+3
View File
@@ -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",
}