Repository navigation
Conversation
sxzz
left a comment
There was a problem hiding this comment.
Avoid wrapping everything in try blocks. Instead, extract a env variable for reading environment variables.
// simple example
let env
try {
env = process.env
} catch {}Also, please provide a minimal reproduction demonstrating why accessing process.env causes an error.
|
Thanks for the (speedy) review! Updated as per your suggestion. It's much cleaner indeed 🙂 Note that I did amend and force-push the commit, to align it better with your commit message style. Not sure if it matters for you, but if you're wondering about the force pushing, that's that 😉 As for the reproduction case, consider a file import 'npm:[email protected]'Then, run it using |
Description
This creates some try-catch blocks around bits that ask for access to environment variables. Functionally, this allows the host environment to reject access to env variables, while maintaining
obug's functionality.Linked Issues
Resolves #4.
Additional context
I opened this PR fully aware that it may be rejected, as my issue has just been opened and neither the feature nor its solution has been discussed with the maintainer.