Try/catch in errorHandler to deal with res object not being valid when
it's called.