fastapi-error-map 0.9.3__tar.gz → 0.9.4__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.
Files changed (34) hide show
  1. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/PKG-INFO +8 -3
  2. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/README.md +7 -2
  3. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/fastapi_error_map/translators.py +1 -1
  4. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/pyproject.toml +5 -1
  5. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/unit/translator_stubs.py +2 -2
  6. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/.github/workflows/ci.yaml +0 -0
  7. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/.github/workflows/test-compatibility.yaml +0 -0
  8. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/.gitignore +0 -0
  9. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/.pre-commit-config.yaml +0 -0
  10. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/LICENSE +0 -0
  11. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/Makefile +0 -0
  12. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/docs/example-openapi.png +0 -0
  13. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/examples/__init__.py +0 -0
  14. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/examples/errors.py +0 -0
  15. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/examples/main.py +0 -0
  16. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/fastapi_error_map/__init__.py +0 -0
  17. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/fastapi_error_map/error_handling.py +0 -0
  18. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/fastapi_error_map/openapi.py +0 -0
  19. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/fastapi_error_map/py.typed +0 -0
  20. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/fastapi_error_map/routing.py +0 -0
  21. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/fastapi_error_map/rules.py +0 -0
  22. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/fastapi_error_map/translator_policy.py +0 -0
  23. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/noxfile.py +0 -0
  24. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/__init__.py +0 -0
  25. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/integration/__init__.py +0 -0
  26. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/integration/test_example.py +0 -0
  27. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/integration/test_routing.py +0 -0
  28. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/unit/__init__.py +0 -0
  29. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/unit/error_stubs.py +0 -0
  30. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/unit/test_error_handling.py +0 -0
  31. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/unit/test_openapi.py +0 -0
  32. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/unit/test_rules.py +0 -0
  33. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/tests/unit/test_translators.py +0 -0
  34. {fastapi_error_map-0.9.3 → fastapi_error_map-0.9.4}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-error-map
3
- Version: 0.9.3
3
+ Version: 0.9.4
4
4
  Summary: Elegant per-endpoint error handling in FastAPI with OpenAPI schema generation
5
5
  Project-URL: Homepage, https://github.com/ivan-borovets/fastapi-error-map
6
6
  Project-URL: Repository, https://github.com/ivan-borovets/fastapi-error-map
@@ -41,7 +41,7 @@ Description-Content-Type: text/markdown
41
41
 
42
42
  ## FastAPI Error Map
43
43
 
44
- [![PyPI version](https://badge.fury.io/py/fastapi-error-map.svg?cacheBust=2)](https://badge.fury.io/py/fastapi-error-map)
44
+ [![PyPI version](https://badge.fury.io/py/fastapi-error-map.svg?cacheBust=4)](https://badge.fury.io/py/fastapi-error-map)
45
45
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fastapi-error-map?cacheBust=1)
46
46
  [![codecov](https://codecov.io/gh/ivan-borovets/fastapi-error-map/branch/master/graph/badge.svg?token=ABTVQLI0RL)](https://codecov.io/gh/ivan-borovets/fastapi-error-map)
47
47
  ![GitHub License](https://img.shields.io/github/license/ivan-borovets/fastapi-error-map?cacheBust=1)
@@ -260,6 +260,11 @@ If it raises, the exception propagates and the request fails.
260
260
  This is intentional to avoid hiding errors in side effects — they should be fixed rather than silently ignored.
261
261
  Keep `on_error` robust or wrap it on your side if you prefer soft-fail logging.
262
262
 
263
+ > [!NOTE]
264
+ > Both translator and `on_error` receive the raised exception as an argument.
265
+ > If your implementation does not use it, suppress the unused-argument warning from your linter (e.g. `# noqa: ARG002`
266
+ > for Ruff).
267
+
263
268
  ### 🧠 Parameter Precedence
264
269
 
265
270
  Error handling and schema generation in `fastapi-error-map` are fully driven by route-level arguments to `.get()`,
@@ -318,7 +323,7 @@ from `error_map` — but only for the specified status codes.
318
323
 
319
324
  ```
320
325
 
321
- #### 🚨 Handling Unmapped Exceptions (`warn_on_unmapped`)
326
+ #### Handling Unmapped Exceptions (`warn_on_unmapped`)
322
327
 
323
328
  By default (`warn_on_unmapped=True`), `fastapi-error-map` expects every exception raised in a handler to be explicitly
324
329
  listed in `error_map`.
@@ -1,6 +1,6 @@
1
1
  ## FastAPI Error Map
2
2
 
3
- [![PyPI version](https://badge.fury.io/py/fastapi-error-map.svg?cacheBust=2)](https://badge.fury.io/py/fastapi-error-map)
3
+ [![PyPI version](https://badge.fury.io/py/fastapi-error-map.svg?cacheBust=4)](https://badge.fury.io/py/fastapi-error-map)
4
4
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fastapi-error-map?cacheBust=1)
5
5
  [![codecov](https://codecov.io/gh/ivan-borovets/fastapi-error-map/branch/master/graph/badge.svg?token=ABTVQLI0RL)](https://codecov.io/gh/ivan-borovets/fastapi-error-map)
6
6
  ![GitHub License](https://img.shields.io/github/license/ivan-borovets/fastapi-error-map?cacheBust=1)
@@ -219,6 +219,11 @@ If it raises, the exception propagates and the request fails.
219
219
  This is intentional to avoid hiding errors in side effects — they should be fixed rather than silently ignored.
220
220
  Keep `on_error` robust or wrap it on your side if you prefer soft-fail logging.
221
221
 
222
+ > [!NOTE]
223
+ > Both translator and `on_error` receive the raised exception as an argument.
224
+ > If your implementation does not use it, suppress the unused-argument warning from your linter (e.g. `# noqa: ARG002`
225
+ > for Ruff).
226
+
222
227
  ### 🧠 Parameter Precedence
223
228
 
224
229
  Error handling and schema generation in `fastapi-error-map` are fully driven by route-level arguments to `.get()`,
@@ -277,7 +282,7 @@ from `error_map` — but only for the specified status codes.
277
282
 
278
283
  ```
279
284
 
280
- #### 🚨 Handling Unmapped Exceptions (`warn_on_unmapped`)
285
+ #### Handling Unmapped Exceptions (`warn_on_unmapped`)
281
286
 
282
287
  By default (`warn_on_unmapped=True`), `fastapi-error-map` expects every exception raised in a handler to be explicitly
283
288
  listed in `error_map`.
@@ -71,5 +71,5 @@ class DefaultServerErrorTranslator(ErrorTranslator[SimpleErrorResponseModel]):
71
71
  def error_response_model_cls(self) -> type[SimpleErrorResponseModel]:
72
72
  return SimpleErrorResponseModel
73
73
 
74
- def from_error(self, _err: Exception) -> SimpleErrorResponseModel:
74
+ def from_error(self, err: Exception) -> SimpleErrorResponseModel:
75
75
  return SimpleErrorResponseModel(error="Internal server error")
@@ -7,7 +7,7 @@ sources = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "fastapi-error-map"
10
- version = "0.9.3"
10
+ version = "0.9.4"
11
11
  description = "Elegant per-endpoint error handling in FastAPI with OpenAPI schema generation"
12
12
  readme = "README.md"
13
13
  license = { text = "Apache-2.0" }
@@ -160,6 +160,7 @@ split-on-trailing-comma = true
160
160
 
161
161
  [tool.ruff.lint.per-file-ignores]
162
162
  "tests/**" = [
163
+ "ARG002", # unused-method-argument
163
164
  "PLR2004", # magic-value-comparison
164
165
  "S101", # assert
165
166
  ]
@@ -175,6 +176,9 @@ split-on-trailing-comma = true
175
176
  "UP006", # non-pep585-annotation
176
177
  "UP035", # deprecated-import
177
178
  ]
179
+ "src/fastapi_error_map/translators.py" = [
180
+ "ARG002", # unused-method-argument
181
+ ]
178
182
 
179
183
  [tool.slotscheck]
180
184
  strict-imports = true
@@ -27,7 +27,7 @@ class DummyServerErrorTranslator(ErrorTranslator[ServerErrorStub]):
27
27
  def error_response_model_cls(self) -> type[ServerErrorStub]:
28
28
  return ServerErrorStub
29
29
 
30
- def from_error(self, _err: Exception) -> ServerErrorStub:
30
+ def from_error(self, err: Exception) -> ServerErrorStub:
31
31
  return ServerErrorStub(error="internal")
32
32
 
33
33
 
@@ -36,5 +36,5 @@ class CustomTranslator(ErrorTranslator[dict[str, str]]):
36
36
  def error_response_model_cls(self) -> type[dict[str, str]]:
37
37
  return dict
38
38
 
39
- def from_error(self, _err: Exception) -> dict[str, str]:
39
+ def from_error(self, err: Exception) -> dict[str, str]:
40
40
  return {"msg": "explicit"}