In an effort to standardize our error reporting to the client, we should create a custom error handling middleware (see).
This would enable us to simply throw an exception when we want to report an error to the user instead of mucking about with a response factory. The exception we throw probably should contain a StatusCode and maybe some Header information as well to help customize the response.
In an effort to standardize our error reporting to the client, we should create a custom error handling middleware (see).
This would enable us to simply throw an exception when we want to report an error to the user instead of mucking about with a response factory. The exception we throw probably should contain a
StatusCode
and maybe some Header information as well to help customize the response.