Implement the errorHandler method