ZeroIntensity / view.py

The Batteries-Detachable Web Framework
https://view.zintensity.dev
MIT License
205 stars 15 forks source link

HTTP Exceptions #97

Closed ZeroIntensity closed 8 months ago

ZeroIntensity commented 10 months ago

Feature description

FastAPI supports sending errors via HTTP exceptions. This shouldn't be too hard to implement.

Feature example API

from view import new_app, Error

app = new_app()

@app.get("/")
async def index():
    raise Error(400, "you forgot to do something")

app.run()

Anything else?

This should likely inherit from BaseException, not Exception to change the mechanics/expected result a bit more.

ZeroIntensity commented 10 months ago

Will be waiting on #51.