nwa-stdlib 1.7.2__tar.gz → 1.7.3__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.
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/.bumpversion.cfg +1 -1
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/PKG-INFO +1 -1
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/__init__.py +1 -1
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/graphql/extensions/error_handler_extension.py +6 -2
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/.github/dependabot.yml +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/.github/workflows/publish-release.yaml +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/.github/workflows/scheduled-build.yml +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/.github/workflows/test-package.yaml +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/.gitignore +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/.pre-commit-config.yaml +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/.stignore +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/LICENSE +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/NOTICE +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/README.md +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/benchmarks/benchmark_async_cache_with_json.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/benchmarks/benchmark_async_cache_with_orjson.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/benchmarks/benchmark_async_cache_with_pickle.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/benchmarks/shared.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/docs/debugging.md +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/asyncio.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/asyncio_cache.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/debugging.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/ex.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/f.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/graphql/__init__.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/graphql/extensions/__init__.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/graphql/extensions/deprecation_checker_extension.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/logging.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/py.typed +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/settings.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/url.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/version.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/vlans.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/pyproject.toml +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/setup.cfg +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/tests/__init__.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/tests/conftest.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/tests/graphql/__init__.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/tests/graphql/test_deprecation_checker_extension.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/tests/graphql/test_error_handler_extension.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/tests/test_asyncio.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/tests/test_asyncio_cache.py +0 -0
- {nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/tests/test_vlans.py +0 -0
{nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/graphql/extensions/error_handler_extension.py
RENAMED
|
@@ -37,11 +37,13 @@ class ErrorType(StrEnum):
|
|
|
37
37
|
https://engineering.zalando.com/posts/2021/04/modeling-errors-in-graphql.html
|
|
38
38
|
|
|
39
39
|
We currently distinguish 3 categories that are meaningful to the frontend/user:
|
|
40
|
-
-
|
|
40
|
+
- NOT_AUTHENTICATED: unauthenticated user or expired token, user should authenticate
|
|
41
|
+
- NOT_AUTHORIZED: user not allowed to perform operation on this resource
|
|
41
42
|
- NOT_FOUND: a resource wasn't found, data inconsistency or wrong identifier
|
|
42
43
|
- INTERNAL_ERROR: all other errors on the graphql server and/or backend systems. User may retry later
|
|
43
44
|
"""
|
|
44
45
|
|
|
46
|
+
NOT_AUTHENTICATED = auto()
|
|
45
47
|
NOT_AUTHORIZED = auto()
|
|
46
48
|
NOT_FOUND = auto()
|
|
47
49
|
INTERNAL_ERROR = auto()
|
|
@@ -59,7 +61,9 @@ def default_to_error_type(exception: Exception | None) -> ErrorType:
|
|
|
59
61
|
match exception:
|
|
60
62
|
case PermissionError():
|
|
61
63
|
return ErrorType.NOT_AUTHORIZED
|
|
62
|
-
case Exception() if _is_http_error(exception, HTTPStatus.
|
|
64
|
+
case Exception() if _is_http_error(exception, HTTPStatus.UNAUTHORIZED):
|
|
65
|
+
return ErrorType.NOT_AUTHENTICATED
|
|
66
|
+
case Exception() if _is_http_error(exception, HTTPStatus.FORBIDDEN):
|
|
63
67
|
return ErrorType.NOT_AUTHORIZED
|
|
64
68
|
case Exception() if _is_http_error(exception, HTTPStatus.NOT_FOUND):
|
|
65
69
|
return ErrorType.NOT_FOUND
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nwa_stdlib-1.7.2 → nwa_stdlib-1.7.3}/nwastdlib/graphql/extensions/deprecation_checker_extension.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|