feat(forefront): add try catch
このコミットが含まれているのは:
コミット
9d5cc5cf08
|
@ -51,7 +51,7 @@ class AccountPool {
|
|||
}
|
||||
}
|
||||
|
||||
public delete(id:string) {
|
||||
public delete(id: string) {
|
||||
this.pool = this.pool.filter(item => item.id !== id);
|
||||
this.syncfile();
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ export class Forefrontnew extends Chat {
|
|||
return [page, account, account.id];
|
||||
} catch (e) {
|
||||
console.warn('something error happened,err:', e);
|
||||
this.accountPool.delete(account?.id||"")
|
||||
this.accountPool.delete(account?.id || "")
|
||||
const newAccount = this.accountPool.get();
|
||||
return [undefined, this.accountPool.get(), newAccount.id] as any;
|
||||
}
|
||||
|
@ -260,6 +260,7 @@ export class Forefrontnew extends Chat {
|
|||
pt.end();
|
||||
return {text: pt.stream};
|
||||
}
|
||||
try {
|
||||
console.log('try to find input');
|
||||
await page.waitForSelector('.relative > .flex > .w-full > .text-th-primary-dark > div', {
|
||||
timeout: 10000,
|
||||
|
@ -274,6 +275,15 @@ export class Forefrontnew extends Chat {
|
|||
// find markdown list container
|
||||
const mdList = await page.$('#__next > .flex > .relative > .relative > .w-full:nth-child(1) > div');
|
||||
const md = mdList;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
const newAccount = this.accountPool.get();
|
||||
destroy(newAccount.id);
|
||||
pt.write("error", 'some thing error, try again later');
|
||||
pt.end();
|
||||
return {text: pt.stream}
|
||||
}
|
||||
|
||||
// get latest markdown id
|
||||
let id = 4;
|
||||
(async () => {
|
||||
|
|
読み込み中…
新しいイシューから参照