Rescue subclasses in error middleware.