fix some error cannot be caught due to error throw by async promise executor cannot cause promise transition to rejected status

This commit is contained in:
geekgeekrun
2024-04-05 17:18:42 +08:00
parent 3ea1f2e22c
commit ebf7d18a10
@@ -175,6 +175,7 @@ export async function mainLoop (hooks) {
try { try {
const { targetJobElProxy, targetJobIndex } = await new Promise(async (resolve, reject) => { const { targetJobElProxy, targetJobIndex } = await new Promise(async (resolve, reject) => {
try {
// job list // job list
const recommendJobListElProxy = await page.$('.job-list-container .rec-job-list') const recommendJobListElProxy = await page.$('.job-list-container .rec-job-list')
@@ -270,6 +271,9 @@ export async function mainLoop (hooks) {
targetJobIndex targetJobIndex
} }
) )
} catch(err) {
reject(err)
}
}) })
if (targetJobIndex >= 0) { if (targetJobIndex >= 0) {
// scroll that target element into view // scroll that target element into view