Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Commit

Permalink
完善错误截图
Browse files Browse the repository at this point in the history
  • Loading branch information
catlair committed May 4, 2021
1 parent 5c92da4 commit b999c4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/dailyTask/getFollow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ export default async function (page: Page): Promise<Page> {
errorflag = true;
logger.error(error.message);

const curTime = Date.now();
logger.debug(page.url());
logger.debug('出现bug,截图中...');
logger.debug('出现bug,截图中...', curTime);
await page.screenshot({
path: `./logs/${Date.now()}-getfollow.png`,
path: `./logs/${curTime}-getfollow.png`,
});

if (curFollowUrl && curFollowUrl.length !== 0) {
Expand Down
6 changes: 4 additions & 2 deletions src/dailyTask/upTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,11 @@ export class UPTask {
try {
await Promise.all(runArray);
} catch (error) {
logger.debug('出现bug,截图中...');
logger.error(error.message);
const curTime = Date.now();
logger.debug('出现bug,截图中...', curTime);
await this.page.screenshot({
path: `./logs/${Date.now()}-upTask.png`,
path: `./logs/${curTime}-upTask.png`,
});
throw error;
}
Expand Down

0 comments on commit b999c4e

Please sign in to comment.