Closed
Description
Describe the bug
Lines 139 to 184 in 3262878
Referring to the code above, since the config is set when the Sanic object is initialized, you cannot pass a fallback value to the ErrorHandler even if you set config.update_config
or app.config.FALLBACK_ERROR_FORMAT = "json"
.
To solve this, you can pass the config argument when initializing the Sanic app, but this doesn't seem to be intended.
Code snippet
app = Sanic(__name__)
@app.main_process_start
async def start(app, loop):
app.config.FALLBACK_ERROR_FORMAT = "json"
Expected behavior
Even if you use config.update_config
or app.config.FALLBACK_ERROR_FORMAT = "json"
, the error handler should normally receive this value.
Environment (please complete the following information):
- OS: [Windows 10]
- Version [21.9.1]
Additional context
I wanted to open a PR on this issue, but I'm not sure where to touch.