Skip to content

Commit

Permalink
Add api error response
Browse files Browse the repository at this point in the history
  • Loading branch information
samarpan1738 committed Dec 22, 2024
1 parent b29588d commit 39d1972
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions todo/dto/responses/error_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from enum import Enum
from typing import Dict, List
from pydantic import BaseModel


class ApiErrorSource(Enum):
PARAMETER = "parameter"
POINTER = "pointer"
HEADER = "header"


class ApiErrorDetail(BaseModel):
source: Dict[ApiErrorSource, str] | None = None
title: str | None = None
detail: str | None = None


class ApiErrorResponse(BaseModel):
statusCode: int
message: str
errors: List[ApiErrorDetail]

0 comments on commit 39d1972

Please sign in to comment.