treewide: abort -> throw where it makes sense#45637
treewide: abort -> throw where it makes sense#45637infinisil wants to merge 1 commit intoNixOS:masterfrom
Conversation
|
Yeah I 've never seen any consistency in one or the other. I assume people use one cause they didn't know of the other. |
default.nix
Outdated
There was a problem hiding this comment.
Is this maybe a special case? Some commands like nix-env -qa will silently ignore throw as it issues an assertion error while abort will result in an evaluation error.
There was a problem hiding this comment.
Yes, this should stay abort.
|
As @Mic92 said, |
|
@Profpatsch may be you point to the examples in |
Profpatsch
left a comment
There was a problem hiding this comment.
I commented on the first few changes, it looks to me like nearly all of these are programmer errors that should abort the evaluation whenever they happen (not skippable, like with throw).
So I’m against this change.
default.nix
Outdated
There was a problem hiding this comment.
Yes, this should stay abort.
lib/attrsets.nix
Outdated
lib/generators.nix
Outdated
There was a problem hiding this comment.
abort, is a programmer error.
lib/generators.nix
Outdated
There was a problem hiding this comment.
abort, is a failed pattern match and thus a programmer error.
lib/generators.nix
Outdated
lib/modules.nix
Outdated
There was a problem hiding this comment.
Also a programmer error, abort.
lib/options.nix
Outdated
lib/options.nix
Outdated
nixos/lib/testing.nix
Outdated
|
Added |
465aa0e to
49105db
Compare
|
Ah yes, thanks @Profpatsch! Makes sense for those to be aborts as you explained. I undid those ones. |
|
Can this be merged like this? This now only changes the |
|
I am not sure why @edolstra was against the pull request and if those issues are still present. |
|
Can't be bothered with this |
Motivation for this change
I don't really care about this getting merged, but I'd like to find out whether there's any reason for using aborts. Please let me know if you have any valid use case, because I couldn't find any. I also asked many people but nobody had one.
I have NOT tested this in any way, let me know if this breaks anything, which might just be a reason for having aborts then.
Note that I'm looking for actual use cases, not theoretical ones.
Ping @Profpatsch
Things done
sandboxinnix.confon non-NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)nix path-info -Sbefore and after)