fix(service-auto): mapare ORA-01438 → 422 pentru ID invalid

ORA-01438 (value larger than column precision) apare când
id_masiniclient depășește precizia coloanei Oracle. Este eroare
de input, nu server error — mapăm la 422 Unprocessable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-04-12 23:41:40 +00:00
parent cc24aacfdf
commit 31d1f511c3

View File

@@ -33,6 +33,10 @@ def _handle_oracle_error(e: Exception) -> NoReturn:
clean = re.sub(r"^ORA-\d+:\s*", "", raw_message).strip() clean = re.sub(r"^ORA-\d+:\s*", "", raw_message).strip()
raise HTTPException(status_code=422, detail=clean) raise HTTPException(status_code=422, detail=clean)
if code == 1438:
# ORA-01438: value larger than specified precision — bad input ID (e.g. id_masiniclient out of range)
raise HTTPException(status_code=422, detail="Valoare invalidă pentru câmp (ID prea mare)")
if code in (12541, 12170, 12154, 12560): if code in (12541, 12170, 12154, 12560):
raise HTTPException( raise HTTPException(
status_code=503, status_code=503,