Skip to content

Commit

Permalink
1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldziher committed Feb 21, 2022
1 parent c845244 commit 28f73c0
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 53 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,8 @@
[1.2.2]

- fix regression with controller multi-registration

[1.2.3]

- update `LoggingConfig` to be non-blocking @madlad33
- fix regression in error handling, returning 404 instead of 500
4 changes: 2 additions & 2 deletions docs/usage/0-the-starlite-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ my_app_logging_config = LoggingConfig(
app = Starlite(on_startup=[my_app_logging_config.configure])
```

`LoggingConfig` is **merely a convenience wrapper** around the standard library's _DictConfig_ options, which can be rather
confusing.
`LoggingConfig` is a convenience wrapper around the standard library's _DictConfig_ options, which can be rather
confusing. It pre-configures logging to use the `QueueHandler`, which is non-blocking and recommended for async applications.

In the above we defined a logger for the "my_app" namespace with a level of "INFO", i.e. only messages of INFO severity
or above will be logged by it, using the `LoggingConfig` default console handler, which will emit logging messages to \*
Expand Down
90 changes: 45 additions & 45 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "starlite"
version = "1.2.2"
version = "1.2.3"
description = "Light-weight and flexible ASGI API Framework"
authors = ["Na'aman Hirschfeld <nhirschfeld@gmail.com>"]
maintainers = ["Na'aman Hirschfeld <nhirschfeld@gmail.com>", "Ashwin Vinod <ashwinvinodsa@gmail.com>"]
Expand Down
3 changes: 2 additions & 1 deletion starlite/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
handlers[scope_type if scope_type in handler_types else "asgi"],
)
scope["path_params"] = parse_path_params(route.path_parameters, path_params) if route.path_parameters else {} # type: ignore
await route.handle(scope=scope, receive=receive, send=send)
except KeyError as e:
raise NotFoundException() from e
else:
await route.handle(scope=scope, receive=receive, send=send)

async def call_lifecycle_handler(self, handler: LifeCycleHandler) -> None:
"""
Expand Down
6 changes: 2 additions & 4 deletions tests/app/test_error_handling.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import pytest

from starlette.exceptions import HTTPException as StarletteHTTPException
from starlette.status import HTTP_400_BAD_REQUEST, HTTP_500_INTERNAL_SERVER_ERROR
Expand Down Expand Up @@ -73,12 +72,11 @@ def my_route_handler() -> None:
assert "text/html" in response.headers["content-type"]


@pytest.mark.xfail
def test_route_throws_key_exception() -> None:
def test_handler_error_return_status_500() -> None:
@get("/")
def my_route_handler() -> None:
raise KeyError("custom message")

with create_test_client(my_route_handler) as client:
response = client.get("/")
assert response.status_code == HTTP_400_BAD_REQUEST
assert response.status_code == HTTP_500_INTERNAL_SERVER_ERROR

0 comments on commit 28f73c0

Please sign in to comment.