This commit implements an error handler as a middleware.
For now it handles ParseJsonError with a specific case and the rest of
the errors are json serialized.
.-(17:02:09)-(~)------------------------------------------------------------------------------(neha@vali)-
`---> curl -d '{"tosConsent":false}' -H "Content-Type: application/json" -X POST localhost:3011/.p2/auth/register
{"cause":"parse error: missing field `localName` at line 1 column 20","error":"ParseJsonError"}%
.-(17:06:07)-(~)------------------------------------------------------------------------------(neha@vali)-
`---> curl -H "Content-Type: application/json" -X POST http://localhost:3011/.p2/auth/register
{"cause":"parse error: EOF while parsing a value at line 1 column 0","error":"ParseJsonError"}%
Fixes #2
This commit implements an error handler as a middleware.
For now it handles ParseJsonError with a specific case and the rest of
the errors are json serialized.
```
.-(17:02:09)-(~)------------------------------------------------------------------------------(neha@vali)-
`---> curl -d '{"tosConsent":false}' -H "Content-Type: application/json" -X POST localhost:3011/.p2/auth/register
{"cause":"parse error: missing field `localName` at line 1 column 20","error":"ParseJsonError"}%
.-(17:06:07)-(~)------------------------------------------------------------------------------(neha@vali)-
`---> curl -H "Content-Type: application/json" -X POST http://localhost:3011/.p2/auth/register
{"cause":"parse error: EOF while parsing a value at line 1 column 0","error":"ParseJsonError"}%
```
Fixes https://codeberg.org/polyphony/sonata/issues/2