Skip to content
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

Better exception message #390

Merged
merged 2 commits into from
Dec 22, 2020
Merged

Better exception message #390

merged 2 commits into from
Dec 22, 2020

Conversation

mayuki
Copy link
Member

@mayuki mayuki commented Dec 21, 2020

On the client side, clarify the message of exceptions thrown by StreamingHub handler.

Before

Unhandled Exception with IsReturnExceptionStackTraceInErrorDetail=true

Unhandled exception. Grpc.Core.RpcException: System.InvalidOperationException: shinu
   at MyApp.Server.Hubs.TimerHub.SetAsync(TimeSpan interval)
   ...

Unhandled Exception with IsReturnExceptionStackTraceInErrorDetail=false

Unhandled exception. Grpc.Core.RpcException: Exception of type 'Grpc.Core.RpcException' was thrown.
   at MagicOnion.Client.StreamingHubClientBase`2.WriteMessageWithResponseAsync[TRequest,TResponse](Int32 methodId, TRequest message)
   ...

ReturnStatusException

Unhandled exception. Grpc.Core.RpcException: Exception of type 'Grpc.Core.RpcException' was thrown.
   at MagicOnion.Client.StreamingHubClientBase`2.WriteMessageWithResponseAsync[TRequest,TResponse](Int32 methodId, TRequest message)
   ...

After

Unhandled Exception with IsReturnExceptionStackTraceInErrorDetail=true

Unhandled exception. Grpc.Core.RpcException: An error occurred while processing handler 'ITimerHub/SetAsync'.
System.InvalidOperationException: shinu
   at MyApp.Server.Hubs.TimerHub.SetAsync(TimeSpan interval)
   ...

Unhandled Exception with IsReturnExceptionStackTraceInErrorDetail=false

Unhandled exception. Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="An error occurred while processing handler 'ITimerHub/SetAsync'.")
   at MagicOnion.Client.StreamingHubClientBase`2.WriteMessageWithResponseAsync[TRequest,TResponse](Int32 methodId, TRequest message)
   ...

ReturnStatusException

Unhandled exception. Grpc.Core.RpcException: Status(StatusCode="AlreadyExists", Detail="Sudeniaru")
   at MagicOnion.Client.StreamingHubClientBase`2.WriteMessageWithResponseAsync[TRequest,TResponse](Int32 methodId, TRequest message)
   ...

@mayuki mayuki requested a review from neuecc December 21, 2020 09:39
Copy link
Member

@neuecc neuecc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!!!

@mayuki mayuki merged commit be3f865 into master Dec 22, 2020
@mayuki mayuki deleted the feature/HumanFriendlyException branch December 22, 2020 01:40
@ShyDoki
Copy link

ShyDoki commented Dec 22, 2020

Good!!!

AntonC9018 pushed a commit to AntonC9018/MagicOnion that referenced this pull request Sep 13, 2022
AntonC9018 pushed a commit to AntonC9018/MagicOnion that referenced this pull request Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants