Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle errors in the collect function with a try-catch block. #66

Merged
merged 2 commits into from
Jul 27, 2023

Conversation

bachdumpling
Copy link
Contributor

This PR potentially fix the issue of tmp file not properly cleared after a failed scan, leading to: ENOSPC: no space left on device, mkdir '/tmp/tmp-8-bsc9NMF2bYaq'

Here's a brief summary of the changes:

  • Added a try-catch block to the async function to ensure all exceptions are caught and handled appropriately.
  • Upon an error, the browser is closed to free up resources. User data directory and output directory are cleared in case of an error to ensure no data remains.
  • In the case of an error, the function now returns an object with status 'failed' and a message indicating that the run failed. Finally, it will make sure to clean tmp directories to handle the next scan.
  • example.ts also got updated with error logging.

…the example file to use new try-catch logic in collect function
@dphiffer dphiffer merged commit 6af1e91 into main Jul 27, 2023
1 check passed
@dphiffer dphiffer deleted the fix-disk-issue branch July 27, 2023 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants