Add HubException that always flows back to hub clients #2376

Closed
DamianEdwards opened this Issue Jul 31, 2013 · 3 comments

5 participants

@DamianEdwards
SignalR member

Create a new type HubException that can be thrown from server hub methods. The ctor should take a string message and an object extra error data. SignalR will auto-serialize the exception and send it to the client where it will be used to reject/fail the hub method invocation.

The show detailed hub exceptions setting has no bearing on HubException being sent back to the client or not; it always is.

@halter73 halter73 was assigned Aug 2, 2013
@halter73 halter73 added a commit that referenced this issue Aug 6, 2013
@halter73 halter73 Tests verifying HubException details are sent to clients
- HubConfiguration.EnableDetailedErrors is false

#2376
415e1d5
@halter73 halter73 added a commit that referenced this issue Aug 6, 2013
@halter73 halter73 Tests verifying HubException details are sent to clients
- HubConfiguration.EnableDetailedErrors is false

#2376
63f64dd
@halter73 halter73 added a commit that referenced this issue Aug 7, 2013
@halter73 halter73 Tests verifying HubException details are sent to clients
- HubConfiguration.EnableDetailedErrors is false

#2376
f9bfbe3
@davidfowl
SignalR member

@halter73 after updating JabbR, we need a better discriminator sent from server to client to tell if an exception is a hub exception:

JabbR/JabbR@aa3437c

I only ever want to show HubExeption but I can't tell which is which unless I happen to pass some error data. Instead let's just flow the type back to the client so it can always tell.

@halter73 halter73 was assigned Aug 10, 2013
@gustavo-armenta

Assigning to @halter73 to do change requested by @davidfowl

@NTaylorMullen

Verified this.

Setup:
Modified Status.cs (connect status sample hub) to throw a HubException in Ping.

  1. Ran with Detailed Errors true: Retrieved full HubException when trying to invoke Ping. Failure handler on the ping invoke also triggered.
  2. Ran with Detailed Errors false: Retrieved full HubException when trying to invoke Ping. Failure handler on the ping invoke also triggered.
  3. Modified hub to throw InvalidOperationException - Ran with Detailed Errors true: Retrieved full InvalidOperationException when trying to invoke Ping. Failure handler on the ping invoke also triggered.
  4. Modified hub to throw InvalidOperationException - Ran with Detailed Errors false: Retrieved abstract Exception stating that the invoke to Ping failed, nothing more. Failure handler on the ping invoke also triggered.

Performed the same verification on JS and C#.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment