add more logs
This commit is contained in:
@@ -294,7 +294,6 @@ class CommandorPage {
|
||||
}
|
||||
|
||||
async onPageLoad(currentPage) {
|
||||
console.log("onPageLoad called, url is " + currentPage.url())
|
||||
try {
|
||||
let content = await currentPage.content();
|
||||
let captcha_url = "geo.captcha-delivery.com/captcha";
|
||||
@@ -319,7 +318,7 @@ class CommandorPage {
|
||||
log("successful");
|
||||
await this.push_message_to_queue(PublishType.SUCCESS);
|
||||
} else if (content.includes(EMPTY_RESPONSE_ERROR)) {
|
||||
console.log("EMPTY_RESPONSE_ERROR error received, will quit")
|
||||
log("EMPTY_RESPONSE_ERROR error received, will quit")
|
||||
this.isTerminated = true
|
||||
} else {
|
||||
// try to get errors
|
||||
@@ -388,7 +387,6 @@ class CommandorPage {
|
||||
let errorItem = this.page.locator("div.alert");
|
||||
if (errorItem) {
|
||||
let errorContent = await errorItem.innerHTML();
|
||||
log("error:" + errorContent);
|
||||
await this.handleError(errorContent);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -398,10 +396,12 @@ class CommandorPage {
|
||||
}
|
||||
|
||||
async handleError(errorContent) {
|
||||
log("handle error:" + errorContent);
|
||||
if (errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE) || errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE_FR)) {
|
||||
this.isTerminated = true;
|
||||
} else if (errorContent.includes(TOO_MANY_REQUEST_ERROR_MESSAGE) || errorContent.includes(TOO_MANY_REQUEST_ERROR_MESSAGE_FR)) {
|
||||
// todo, add contact to black list
|
||||
//add contact to black list and set terminated the task
|
||||
log("handle error: will save to black list db");
|
||||
await this.saveToBlackList()
|
||||
} else if (errorContent.includes(CAPTCHA_ERROR_MESSAGE) || errorContent.includes(CAPTCHA_ERROR_MESSAGE_FR)) {
|
||||
this.isTerminated = true;
|
||||
|
||||
Reference in New Issue
Block a user