Repository navigation
0.4.0
Highlight
Error handling
Now, you can add your custom error handler, like this:
from nexify import Nexify
class YourCustomException(Exception):
pass
def custom_exception_handler(event, context, e):
return {"statusCode": 400, "body": str(e)}
app = Nexify(exception_handlers={YourCustomException: custom_exception_handler})Also, Nexify have default handler for HTTPException, RequestValidationError, ResponseValidationError.
app = Nexify()
@app.get("/items/{id}")
def read_item(id: Annotated[int, Path()]): ...For example, if you sent a request to items/foo, you would receive a response like this:
{
"detail": [
{
"type": "int_parsing",
"loc": ["path", "id"],
"msg": "Input should be a valid integer, unable to parse string as an integer",
"input": "foo",
}
]
}Features
Fixes
- 🐛 Fix invalid resource creation for root path. Commit 12c24dd by @junah201
- 🐛 Fix invalid log group name in template. Commit ae75f63 by @junah201