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:

  1. 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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.