Skip to content

Commit b56596d

Browse files
committed
Add support for ValidationError argument params
This isn't part of released django-rest-framework, but has been merged upstream. Upstream PR: encode/django-rest-framework#8863
1 parent 4fb7adf commit b56596d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

rest_framework-stubs/exceptions.pyi

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from collections.abc import Sequence
22
from typing import Any
33

4-
from typing_extensions import TypeAlias
5-
64
from django.http import HttpRequest, JsonResponse
75
from django_stubs_ext import StrOrPromise
86
from rest_framework.renderers import BaseRenderer
97
from rest_framework.request import Request
8+
from typing_extensions import TypeAlias
109

1110
def _get_error_details(data: Any, default_code: str | None = ...) -> Any: ...
1211
def _get_codes(detail: Any) -> Any: ...
@@ -28,7 +27,12 @@ class APIException(Exception):
2827
def get_codes(self) -> Any: ...
2928
def get_full_details(self) -> Any: ...
3029

31-
class ValidationError(APIException): ...
30+
class ValidationError(APIException):
31+
default_params: Mapping[str, Any]
32+
def __init__(
33+
self, detail: _Detail | None = ..., code: str | None = ..., params: Mapping[str, Any] | None = ...
34+
) -> None: ...
35+
3236
class ParseError(APIException): ...
3337
class AuthenticationFailed(APIException): ...
3438
class NotAuthenticated(APIException): ...

0 commit comments

Comments
 (0)