Add spec for formatter middleware error handling