Handling errors
In this last recipe of the chapter, we want to achieve a smarter exception-handling strategy, and for that we apply some of the lessons we learned about the extensibility features of SignalR, along with some other features specific of error management.
Getting ready
For this recipe, we'll use a new empty web application, which we'll call Recipe46
.
How to do it…
Our code will contain a Hub with a couple of methods raising exceptions, and the following steps will illustrate how to work around them in order to collect and manage information about the errors:
- We create a new Hub called
FailingHub
using the SignalR Hub Class (v2) template. The following is what it should look like:using System; using Microsoft.AspNet.SignalR; using Microsoft.AspNet.SignalR.Hubs; ...
Get SignalR Real-time Application Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.