$ resp ->is_error ()
resp
Returns true when the response code is 400 through 599. When an error occurs, you might want to use error_as_HTML to generate an HTML explanation of the error.
error_as_HTML
Copyright © 2001 O'Reilly & Associates. All rights reserved.