* fix: add validation for empty hosts in round robin reassignment - Add check for empty availableUsers array before calling getLuckyUser - Throw RoundRobinHostsUnavailableForBooking error instead of 500 error - Use existing error infrastructure with 409 status code and localized message - Prevents runtime errors when no round robin hosts are available for reassignment Co-Authored-By: joe@cal.com <joe@cal.com> * fix: check eventType.hosts.length directly for empty hosts validation - Move validation to check eventType.hosts.length === 0 immediately after hosts array setup - Remove later validation after ensureAvailableUsers to catch issue earlier - Follows user feedback to check hosts array directly instead of availableUsers Co-Authored-By: joe@cal.com <joe@cal.com> * fix: update translation message for round robin hosts unavailable error - Make error message clearer about event type having no hosts - Change from 'No Round Robin hosts is available for booking' to 'No hosts are available in this event type for round robin booking' Co-Authored-By: joe@cal.com <joe@cal.com> * Change error for event type no hosts * fix: add ErrorCode.EventTypeNoHosts to switch statement for 400 status code Addresses GitHub comment from keithwillcode to ensure EventTypeNoHosts error returns proper 400 Bad Request status instead of defaulting to 500. Co-Authored-By: joe@cal.com <joe@cal.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: joe@cal.com <joe@cal.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
28 lines
1.6 KiB
TypeScript
28 lines
1.6 KiB
TypeScript
export enum ErrorCode {
|
|
PaymentCreationFailure = "payment_not_created_error",
|
|
NoAvailableUsersFound = "no_available_users_found_error",
|
|
ChargeCardFailure = "couldnt_charge_card_error",
|
|
RequestBodyWithouEnd = "request_body_end_time_internal_error",
|
|
AlreadySignedUpForBooking = "already_signed_up_for_this_booking_error",
|
|
FixedHostsUnavailableForBooking = "fixed_hosts_unavailable_for_booking",
|
|
RoundRobinHostsUnavailableForBooking = "round_robin_hosts_unavailable_for_booking",
|
|
EventTypeNotFound = "event_type_not_found_error",
|
|
BookingNotFound = "booking_not_found_error",
|
|
BookingSeatsFull = "booking_seats_full_error",
|
|
MissingPaymentCredential = "missing_payment_credential_error",
|
|
MissingPaymentAppId = "missing_payment_app_id_error",
|
|
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",
|
|
BookingTimeOutOfBounds = "booking_time_out_of_bounds_error",
|
|
BookingConflict = "booking_conflict_error",
|
|
BookerLimitExceeded = "booker_limit_exceeded_error",
|
|
BookerLimitExceededReschedule = "booker_limit_exceeded_error_reschedule",
|
|
BookingNotAllowedByRestrictionSchedule = "booking_not_allowed_by_restriction_schedule_error",
|
|
RestrictionScheduleNotFound = "restriction_schedule_not_found_error",
|
|
EventTypeNoHosts = "event_type_no_hosts",
|
|
}
|