We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
fs
error.code
Is your feature request related to a problem? Please describe:
When writing a file to a non-existing directory, the error thrown does not expose the error code, making it hard to handle the error.
try { await webcontainer.fs.writeFile('non-existent-path/new-file.ts', content); } catch (err: any) { console.log(error.code) // undefined }
Describe the solution you'd like:
The error thrown should match Node.js's fs errors, at least exposing error.code to allow error handling.
try { await webcontainer.fs.writeFile('non-existent-path/new-file.ts', content); } catch (err: any) { if (error.code === 'ENOENT') { await webcontainer.fs.mkdir('non-existent-path', { recursive: true, }); await webcontainer.fs.writeFile('non-existent-path/new-file.ts', content); } }
Describe alternatives you've considered:
No response
Additional context:
The text was updated successfully, but these errors were encountered:
Hey @leoortizz ! This is a pretty nice idea, I like it a lot. I'll add this to our internal tracking system.
Sorry, something went wrong.
No branches or pull requests
Is your feature request related to a problem? Please describe:
When writing a file to a non-existing directory, the error thrown does not expose the error code, making it hard to handle the error.
Describe the solution you'd like:
The error thrown should match Node.js's
fs
errors, at least exposingerror.code
to allow error handling.Describe alternatives you've considered:
No response
Additional context:
No response
The text was updated successfully, but these errors were encountered: