wasErrorOnRequest
boolean scrapeableFile.wasErrorOnRequest ( )
Description
Determine if an error occurred with the request. Errors are considered to be server timeouts as well as any status code outside of the range 200-399.
Parameters
This method does not receive any parameters.
Return Values
Returns true for server timeouts as well as any status code outside of the range 200-399; otherwise, it returns false.
Change Log
Version | Description |
---|---|
4.5 | Available for all editions. |
This method must be called after the file is scraped.
If you want to know what the status code was you can use getStatusCode.
Examples
Check for Request Errors
// In script called "After file is scraped"
// If an error occurred when the file was requested, an error
// message indicating such gets output to the log.
if( scrapeableFile.wasErrorOnRequest() )
{
session.log( "Connection error occurred." );
}
// If an error occurred when the file was requested, an error
// message indicating such gets output to the log.
if( scrapeableFile.wasErrorOnRequest() )
{
session.log( "Connection error occurred." );
}
scraper on 07/16/2010 at 4:56 pm
- Printer-friendly version
- Login or register to post comments