Description
Returns a map that can be used to output an error message to indicate what checks failed. For instance, you could set a key to the value "Status Code" and the value '200', or a key with "Valid Page" and value 'false'
Parameters
This method takes no parameters
Return Value
Map of keys, or null if no values are indicated
Change Log
Version |
Description |
5.5.29a |
Available in all editions. |
import com.screenscraper.util.retry.RetryPolicy;
_log = log;
_session = session;
RetryPolicy policy = new RetryPolicy()
{
Map errorMap = new HashMap();
boolean isError() throws Exception
{
errorMap.put("Was Error On Request", scrapeableFile.wasErrorOnRequest());
return scrapeableFile.wasErrorOnRequest();
}
void runOnError() throws Exception
{
session.executeScript("Rotate Proxy");
}
Map getErrorChecksMap() throws Exception
{
return errorMap;
}
boolean resetSessionVariablesBeforeRescrape()
{
return true;
}
boolean shouldLogErrors()
{
return true;
}
int getMaxRetryAttempts()
{
return 5;
}
boolean resetReferrerBeforeRescrape()
{
return false;
}
void runOnAllAttemptsFailed()
{
_log.logError("Failed to fix errors with the retry policy, stopping scrape");
_session.stopScraping();
}
};
scrapeableFile.setRetryPolicy(policy);