-
Notifications
You must be signed in to change notification settings - Fork 1
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
Convert all throws into Results #20
Conversation
✅ Deploy Preview for detsys-ts-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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've gotta say I'm not real thrilled about this PR, because it seems weird. Is this a thing that a lot of JS projects are doing? I don't want to be weird here.
if (options.debug) | ||
actionsCore.debug(`Trying to read '${osReleaseFile}'...`); |
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.
if (options.debug) | |
actionsCore.debug(`Trying to read '${osReleaseFile}'...`); | |
if (options.debug) | |
actionsCore.debug(`Trying to read '${osReleaseFile}'...`); |
-1 on the braceless if's
Not a lot of projects do it, no, but throws and try/catch blocks are completely and utterly inscrutable and untraceable in JS. Anything can throw an error at any time and there's no guarantee that that error is properly handled or even surfaced in a way that indicates where it came from. This provides us with full control of the error handling "stack" in a way that JS on its own does not afford. |
And not a lot of projects do it because this is widely seen as one of those this-is-fine.png aspects of working with JS. Just a kind of brute fact we all have to suffer under. It's up to you but I'd like to see us reject that "fact." |
The library is much more well structured now, so I'm less concerned about stray |
A small quality of life thing but one that should have some ergonomic benefits across our Actions. Basically makes this lib more like Rust. No more try/catch, just
Result<T, string>
(where the string is error text). There are still try/catch blocks in this library, of course, but nothing here throws errors. I've also streamlined a few other things, like assigning main and post hooks toIdsToolbox
.You can see an example in DeterminateSystems/nix-installer-action#81