diff options
Diffstat (limited to 'lib/types.nix')
-rw-r--r-- | lib/types.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/types.nix b/lib/types.nix index 4d6ac51c89882..441af98cb9b6b 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -119,7 +119,9 @@ rec { let betweenDesc = lowest: highest: "${toString lowest} and ${toString highest} (both inclusive)"; - between = lowest: highest: assert lowest <= highest; + between = lowest: highest: + assert lib.assertMsg (lowest <= highest) + "ints.between: lowest must be smaller than highest"; addCheck int (x: x >= lowest && x <= highest) // { name = "intBetween"; description = "integer between ${betweenDesc lowest highest}"; @@ -439,7 +441,9 @@ rec { # Either value of type `finalType` or `coercedType`, the latter is # converted to `finalType` using `coerceFunc`. coercedTo = coercedType: coerceFunc: finalType: - assert coercedType.getSubModules == null; + assert assertMsg (coercedType.getSubModules == null) + "coercedTo: coercedType must not have submodules (it’s a ${ + coercedType.description})"; mkOptionType rec { name = "coercedTo"; description = "${finalType.description} or ${coercedType.description} convertible to it"; |