Skip to content

throw vs assert in packages #154292

@Profpatsch

Description

@Profpatsch

@roberth I feel like we are moving in two different directions here, and we should standardize on one of them.

assert lib.asserts.assertOneOf "firewallType" firewallType [ "iptables" "nftables" ];
assert lib.asserts.assertOneOf "dnsType" dnsType [ "internal" "systemd-resolved" ];

^ this was the way most packages wrote assertions so far, and lib.asserts was just a slight improvement over assert.

The new approach is different and diverges from the previous best practice.

Originally posted by @Profpatsch in #153740 (comment)

cc @roberth

Metadata

Metadata

Labels

2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions