Up through SignalR 1.0 RC2, when a hub method threw an exception, the message for the exception got passed down to the client. Now, in 1.0 RTW, when a hub method throws an exception, it simply returns the error message "There was an error invoking
Hub method 'roomhub.GetRoomDescriptor'". This is problematic, because it means that there's no way to figure out what the error was. I know that I could work around this if you wrap every hub method that might throw with a special "Result" object that includes
an Error property, and check that, but that's a PITA. I really liked being able to handle failures in the JQueryDeferred fail() handler: it was nice, it was clean, it was easy.
So two questions:
(1) What's the best way to pass error messages from SignalR down to the client?
ken.smith
Member
6 Points
9 Posts
SignalR 1.0 RTW swallows error messages
Feb 22, 2013 06:19 PM|LINK
Up through SignalR 1.0 RC2, when a hub method threw an exception, the message for the exception got passed down to the client. Now, in 1.0 RTW, when a hub method throws an exception, it simply returns the error message "There was an error invoking Hub method 'roomhub.GetRoomDescriptor'". This is problematic, because it means that there's no way to figure out what the error was. I know that I could work around this if you wrap every hub method that might throw with a special "Result" object that includes an Error property, and check that, but that's a PITA. I really liked being able to handle failures in the JQueryDeferred fail() handler: it was nice, it was clean, it was easy.
So two questions:
(1) What's the best way to pass error messages from SignalR down to the client?
(2) Why did this get changed?
ken.smith
Member
6 Points
9 Posts
Re: SignalR 1.0 RTW swallows error messages
Feb 22, 2013 06:33 PM|LINK
Never mind. Looking at the code, I figured it out. You just need to change how you call MapHubs():
RouteTable.Routes.MapHubs(new HubConfiguration { EnableDetailedErrors = true });davidfowl
Contributor
2695 Points
609 Posts
Microsoft
Re: SignalR 1.0 RTW swallows error messages
Feb 22, 2013 11:43 PM|LINK
You could have also read the release notes https://github.com/SignalR/SignalR/blob/master/ReleaseNotes.md#breaking-changes
Senior SDE, ASP.NET Team, Microsoft