-
Notifications
You must be signed in to change notification settings - Fork 132
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
fix: bail if purs exits non-ok #1285
base: master
Are you sure you want to change the base?
Conversation
|
hmm maybe dying isn't the right thing to do? |
Uh, it looks like this uncovered a funny bug - CI is failing on this test, which should have never passed in the first place because we are supposed to fail in that condition |
src/Spago/Psa.purs
Outdated
logSuccess "Build succeeded." | ||
pure true | ||
else if Array.all identity arrErrorsIsEmpty && not (Cmd.exitedOk result) then do |
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.
Having this code structured as a series of if/else makes it extra confusing, let's move it to a case
statement, e.g.
case Array.all identity arrErrorsIsEmpty, Cmd.exitedOk result of
-- No errors, and 0 exit code
true, true -> ...
-- No errors, but non-zero exit code, so something's up
true, false -> ...
-- Compilation errors, print them out
false, _ -> ...
Let's also try to catch the JSON decoding error earlier: the scenario we are trying to prevent here has err
being an empty string. So let's try to not print the warning if that's the case, hopefully it will reduce the log noise.
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.
ok no problem, ended up changing the output traversal to collect into an array of eithers to defer that logging and changed to a case expression
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.
Code looks good - could we add a test for this? The best way I can think of is to try to pass a nonexistent flag to purs.
Sorry forgot about this. Will do tomorrow! |
@cakekindel did you get around to finish this or shall I take care of the last bits? I'd like to get this merged ASAP before it gets out of date |
Sorry I forgot again, updated & added test!
|
closes #1284
Description of the change
TODO
Checklist:
README
P.S.: the above checks are not compulsory to get a change merged, so you may skip them. However, taking care of them will result in less work for the maintainers and will be much appreciated 😊