Files
nixpkgs/lib
sternenseemann 48965506a1 lib/asserts: use throw to display message for assertMsg
`assert` has the annoying property that it dumps a lot of code at the
user without the built in capability to display a nicer message. We have
worked around this using `assertMsg` which would *additionally* display
a nice message. We can do even better: By using `throw` we can make
evaluation fail before assert draws its conclusions and prevent it from
displaying the code making up the assert condition, so we get the nicer
message of `throw` and the syntactical convenience of `assert`.

Before:

    nix-repl> python.override { reproducibleBuild = true; stripBytecode = false; }
    trace: Deterministic builds require stripping bytecode.
    error: assertion (((lib).assertMsg  (reproducibleBuild -> stripBytecode))  "Deterministic builds require stripping bytecode.") failed at /home/lukas/src/nix/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix:45:1

After:

    nix-repl> python.override { reproducibleBuild = true; stripBytecode = false; }
    error: Deterministic builds require stripping bytecode.
2022-01-19 00:50:06 +01:00
..
2021-12-13 12:03:40 +01:00
2021-01-25 19:25:50 +01:00
2022-01-09 19:21:08 -03:00
2021-01-26 10:57:07 +07:00
2021-08-14 14:46:00 -05:00
2021-10-15 23:10:34 +02:00
2020-06-04 13:43:10 +02:00
2021-09-17 10:03:00 +00:00
2022-01-09 19:21:08 -03:00
2019-09-26 17:42:42 +02:00