af-fastapi-exceptions 0.0.4__tar.gz → 0.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: af-fastapi-exceptions
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Reusable FastAPI base exceptions, ApiMessage, and a unified exception handler
5
5
  License: MIT
6
6
  Author: Allfly
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "af-fastapi-exceptions"
3
- version = "0.0.4"
3
+ version = "0.0.6"
4
4
  description = "Reusable FastAPI base exceptions, ApiMessage, and a unified exception handler"
5
5
  authors = ["Allfly <engineering@allfly.io>"]
6
6
  license = "MIT"
@@ -1,15 +1,4 @@
1
- from allfly.fastapi.exceptions.exceptions import (
2
- BadRequestError,
3
- DownstreamServiceError,
4
- EntityNotFoundError,
5
- ForbiddenError,
6
- ResourceConflictError,
7
- ServiceError,
8
- ServiceWarning,
9
- UnauthorizedRequestError,
10
- UnprocessableRequestError,
11
- UnsupportedFeatureError,
12
- )
1
+ from allfly.fastapi.exceptions.exceptions import * # noqa: F401, F403
13
2
  from allfly.fastapi.exceptions.middleware import (
14
3
  ApiErrorBody,
15
4
  DefaultExceptionHandlerSettings,
@@ -28,8 +17,11 @@ __all__ = [
28
17
  "ForbiddenError",
29
18
  "BadRequestError",
30
19
  "EntityNotFoundError",
20
+ "EntityNotFoundWarning",
31
21
  "ResourceConflictError",
22
+ "ResourceConflictWarning",
32
23
  "UnprocessableRequestError",
24
+ "UnprocessableRequestWarning",
33
25
  "UnsupportedFeatureError",
34
26
  "DownstreamServiceError",
35
27
  "ExceptionMiddleware",
@@ -54,12 +54,21 @@ class ResourceConflictError(ServiceError):
54
54
  status_code = status.HTTP_409_CONFLICT
55
55
  super().__init__(message, status_code)
56
56
 
57
+ class ResourceConflictWarning(ServiceWarning):
58
+ def __init__(self, message="Request creates a conflict"):
59
+ status_code = status.HTTP_409_CONFLICT
60
+ super().__init__(message, status_code)
57
61
 
58
62
  class UnprocessableRequestError(ServiceError):
59
63
  def __init__(self, message="Unprocessable Request"):
60
64
  status_code = status.HTTP_422_UNPROCESSABLE_ENTITY
61
65
  super().__init__(message, status_code)
62
66
 
67
+ class UnprocessableRequestWarning(ServiceWarning):
68
+ def __init__(self, message="Unprocessable Request"):
69
+ status_code = status.HTTP_422_UNPROCESSABLE_ENTITY
70
+ super().__init__(message, status_code)
71
+
63
72
 
64
73
  class UnsupportedFeatureError(ServiceWarning):
65
74
  def __init__(self, message="Not implemented"):