Skip to content

Commit c01a52a

Browse files
committed
Add: ValidationError handling
1 parent 83253d2 commit c01a52a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/api/api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@ async def update_zone(zone_id: int, update: UpdateZone):
255255
)
256256

257257
return zone
258-
258+
except ValidationError:
259+
raise HTTPException(
260+
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
261+
detail=f"One or multiple validation errors in\n{update}"
262+
)
259263
except HTTPException:
260264
raise
261265
except Exception as e:

0 commit comments

Comments
 (0)