-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
catch css file not found #2206
catch css file not found #2206
Conversation
Looks like tests exited with 1 on Windows but passed on all other platforms...? |
Only |
Looks like it's a corrupt binary? Looking at line 1685 of the console output.
|
Restarted the tests hopefully they pass now |
@DeMoorJasper looks like almost every PR has failing tests 😕 |
try { | ||
return await md5.file(this.name); | ||
} catch (err) { | ||
throw new Error(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to catch and re-throw the error here? Isn't that the same as just not catching it in the first place?
@@ -11,11 +11,13 @@ function md5(string, encoding = 'hex') { | |||
md5.file = function(filename) { | |||
return new Promise((resolve, reject) => { | |||
fs.createReadStream(filename) | |||
.on('error', function(error) { | |||
reject(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can write this like before by just passing reject
directly as the callback instead of making a wrapper function
@devongovett good points on both of your comments. Think I got it cleaned up now. Thanks! |
↪️ Pull Request
This should close #2168. The issue was that
md5.js
was trying to create a hash of a non-existent file and not catching the error. I believe I've fixed it by moving the error listener above thepipe
and then adding a try/catch inRawAsset
ongenerateHash()
. I'm definitely open to suggestions on how to improve it. This is my first PR for Parcel and I haven't had a ton of experience with Node apps 😉💻 Examples
🚨 Test instructions
✔️ PR Todo
Added/updated unit tests for this change --> might need some pointers on this if necessary
Filled out test instructions (In case there aren't any unit tests)
Included links to related issues/PRs