detleph / server

Server component of the Detleph event management system
MIT License
1 stars 0 forks source link

The JSON parser throws an unhandled exception upon receiving ill-formatted input #24

Closed stephan418 closed 2 years ago

stephan418 commented 2 years ago

The traceback is then forwarded to the client, which is, however, expecting a standard error response

Stefan-5422 commented 2 years ago

Where is this standard responses detailed?

Also where is the documentation you were writing?

stephan418 commented 2 years ago

The standard response is detailed nowhere, but it should use the format all other endpoints use (with type and payload fields; ref: https://github.com/detleph/server/blob/5b02905d7169a0a1b272fadf22aa178d084f4dbe/src/Controllers/admin.controller.ts#L181)

And I have documentation for the event endpoints. I stopped working on it, however, as it took me nearly 3 hours to write only this part (which is a fraction of the whole thing) and I don't think that is viable for such a limited-use API.

stephan418 commented 2 years ago

And the error occurs whenever data which is not parsable by the JSON parser is sent to the server (for example the string "test"). When this is done, a 400 response with a plain-text traceback is returned

Stefan-5422 commented 2 years ago

Note: This is reffring to the express json parser which will just return a stack trace instead of a normal response.