Skip to content

Commit

Permalink
refactor(function): destroy context and disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Nov 30, 2022
1 parent 7fc349c commit bbcc27b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/function/src/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ async ({ url, gotoOpts, browserWSEndpoint, ...opts }) => {
try {
const value = await browserFn(url)
await browserless.destroyContext()
return { isFulfilled: true, isRejected: false, value }
} catch (error) {
await browserless.destroyContext()
return { isFulfilled: false, isRejected: true, reason: serializeError(error) }
} finally {
await browserless.destroyContext()
await browserless.browser().then(browser => browser.disconnect())
}
}`

Expand Down

0 comments on commit bbcc27b

Please sign in to comment.