Improve availability error messages with date context
- Added date to slot overlap error message - Added date to invalid time range error message - Makes errors more actionable for users
This commit is contained in:
parent
131477b7f3
commit
3369a71271
1 changed files with 2 additions and 2 deletions
|
|
@ -100,7 +100,7 @@ async def set_availability(
|
|||
if sorted_slots[i].end_time > sorted_slots[i + 1].start_time:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail=f"Time slots overlap: {sorted_slots[i].end_time} > {sorted_slots[i + 1].start_time}",
|
||||
detail=f"Time slots overlap on {request.date}: slot ending at {sorted_slots[i].end_time} overlaps with slot starting at {sorted_slots[i + 1].start_time}. Please ensure all time slots are non-overlapping.",
|
||||
)
|
||||
|
||||
# Validate each slot's end_time > start_time
|
||||
|
|
@ -108,7 +108,7 @@ async def set_availability(
|
|||
if slot.end_time <= slot.start_time:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail=f"Slot end time must be after start time: {slot.start_time} - {slot.end_time}",
|
||||
detail=f"Invalid time slot on {request.date}: end time {slot.end_time} must be after start time {slot.start_time}. Please correct the time range.",
|
||||
)
|
||||
|
||||
# Delete existing availability for this date
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue