NSwag
NSwag copied to clipboard
No error Server side but and an error client side saying "An unexpected server error occured"
Hi,
I have a strange situation with a random SwaggerException. I have logged (a lot) the server side to be sure that I have no error, no exception and the status returned is a success:
2019-11-21 13:41:53.076 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Executed action method MYAPP.Api.Controllers.MigrationController.MigrateDeviceAsync (MYAPP.Api), returned result Microsoft.AspNetCore.Mvc.OkResult in 17265.0996ms. 2019-11-21 13:41:53.080 +00:00 [Information] Microsoft.AspNetCore.Mvc.StatusCodeResult: Executing HttpStatusCodeResult, setting HTTP status code 200 2019-11-21 13:41:53.081 +00:00 [Information] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Executed action MYAPP.Api.Controllers.MigrationController.MigrateDeviceAsync (MYAPP.Api) in 17291.4872ms 2019-11-21 13:41:53.082 +00:00 [Information] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executed endpoint 'MYAPP.Api.Controllers.MigrationController.MigrateDeviceAsync (MYAPP.Api)' 2019-11-21 13:41:53.089 +00:00 [Information] Microsoft.AspNetCore.Hosting.Internal.WebHost: Request finished in 17321.9152ms 200
But I got a SwaggerException generated:
{ "isSwaggerException": true, "message": "An unexpected server error occured.", "status": 0, "response": "", "headers": {}, "result": null, "line": 1, "column": 619927, "sourceURL": "https://MYAPP.XXXX.com/main-es2015.0cv36a792ffa00bc8078.js"}
Do you have any idea or suggestions to help?
Thanks
I think the server is not reachable (http status code 0).
@RicoSuter: Could we improve the exceptions generated for such scenarios? I rely on these exceptions for logging and alerts, it's very confusing to read "An unexpected server error occurred" when in reality it could be a client-side network error.
Thanks, that was the issue.
Le jeu. 9 juin 2022 à 07:59, Roberto Santana Perdomo < @.***> a écrit :
@RicoSuter https://github.com/RicoSuter: Could we improve the exceptions generated for such scenarios? I rely on these exceptions for logging and alerts, it's very confusing to read "An unexpected server error occurred" when in reality it could be a client-side network error.
— Reply to this email directly, view it on GitHub https://github.com/RicoSuter/NSwag/issues/2541#issuecomment-1151032138, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANOZJ3QS6N5LVLNXXGTZ6LVOHMD3ANCNFSM4JQFXFFA . You are receiving this because you authored the thread.Message ID: @.***>
@RicoSuter 1.
I think the server is not reachable (http status code 0). I think that "An unexpected server error occured" is not a good error message in case the server is not reachable.
- I agree with @mdarefull that the error messages could be improved. In particular, it would be nice if they were configurable (which would also allow for non-english messages) and if the messages would depend on the status code. I opened #4072 for that.