Moved the error function to the Request class. Allows for overriding the default