Skip to content

Commit

Permalink
fix: 修正返回类型检查错误
Browse files Browse the repository at this point in the history
  • Loading branch information
sj817 committed Nov 4, 2024
1 parent d92140a commit 753733e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/puppeteer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ export class Puppeteer {
* @returns 截图结果
*/
async screenshot<T extends screenshot> (options: T): Promise<RenderResult<T>> {
/** 第一次 */
const result = await this.task(options)
if (Array.isArray(result) || Buffer.isBuffer(result)) return result

/** 第二次 */
console.error('[chrome] 第一次截图失败,正在重试~')
return await this.task(options)
try {
/** 第一次 */
return await this.task(options)
} catch (error) {
/** 第二次 */
console.error('[chrome] 第一次截图失败,正在重试~')
console.error(error)
return await this.task(options)
}
}

/**
Expand Down

0 comments on commit 753733e

Please sign in to comment.