In my Rocket web application I have a service that reads data from a MySQL database. At some point a NULL
value appeared in a VARCHAR
field - something my code wasn't expecting and as a result the tx.query_map()
method started panicing. I don't like the fact that the mysql
crate panics in such cases. But that only comes to show that panics can occur no matter how we write our code - we can never know when an external library will panic instead of returning an error value.
So my question is why does Rocket return a 200 OK
status code in the response with an empty JSON array ([]
) when the panic occurs, instead of returning some error status code like 500
for example? Should I do something explicit in my setup and if yes - what is it?