-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom exception types #8
Comments
Good evening can't we make custom exception middleware and leave it to programmer handle the rest of it
For example we can use some class for custom exception type ` public class HttpResponseException
And write handler for it and leave it to programmer to handle it ` public class ErrorHandlerMiddleware
So this way we could make custom Exceptions more like json api format ant it would be cleaner than throw 500 and some text |
And we should probably add it to the template |
@BokhodirUrinboev sorry, I noticed this comment very late. This approach certainly works, the "meta issue" was more about adding dedicated exception types for some of errors thrown by Fusion. And v6 completely overhauled Fusion's communication stack replacing it with Stl.Rpc, so this approach is less necessary there: Stl.Rpc's default is to serialize the exception type & message automatically. |
This is a "meta issue": currently I mostly throw exceptions of existing exception types from mscorlib. This isn't good in many cases, i.e. adding a few custom types would definitely make it easier to identify certain error scenarios from user code.
On a positive side, I always throw exceptions via Error.* methods, i.e. it's actually pretty easy to identify all the scenarios that would benefit from custom-typed exceptions & update them accordingly.
The text was updated successfully, but these errors were encountered: