Skip to content

Scheduling infrastructure for absolutely everyone.

chore: improve error message (#21112)

Udit Takkarad707b0ee4b6
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json
index a7b187fef74..fad82aff6eb 100644
--- a/apps/web/public/static/locales/en/common.json
+++ b/apps/web/public/static/locales/en/common.json
@@ -846,6 +846,7 @@
"booking_redirect_uri": "URL of your booking page",
"booking_cancel_redirect_uri": "URL of the page where your users can cancel their booking",
"booking_reschedule_redirect_uri": "URL of the page where your users can reschedule their booking",
+ "booking_conflict_error": "This slot is no longer available. Please return to the previous page and select another time.",
"open_invitations": "Open Invitations",
"new_team": "New Team",
"create_first_team_and_invite_others": "Create your first team and invite other users to work together.",
diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts
index 0820df55c49..92e860b2e1d 100644
--- a/packages/features/bookings/lib/handleNewBooking.ts
+++ b/packages/features/bookings/lib/handleNewBooking.ts
@@ -1415,7 +1415,7 @@ async function handler(
err.message
);
if (err.code === "P2002") {
- throw new HttpError({ statusCode: 409, message: "booking_conflict" });
+ throw new HttpError({ statusCode: 409, message: ErrorCode.BookingConflict });
}
throw err;
}
diff --git a/packages/lib/errorCodes.ts b/packages/lib/errorCodes.ts
index 1dcf6baef77..a39174ad70a 100644
--- a/packages/lib/errorCodes.ts
+++ b/packages/lib/errorCodes.ts
@@ -17,4 +17,5 @@ export enum ErrorCode {
UpdatingOauthClientError = "updating_oauth_client_error",
CreatingOauthClientError = "creating_oauth_client_error",
BookingTimeOutOfBounds = "booking_time_out_of_bounds_error",
+ BookingConflict = "booking_conflict_error",
}