From 7a7659844715241f8a05fc5d7a20c07f47463134 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 22 Aug 2013 11:20:57 +0300 Subject: [PATCH] Improve error messages. Improve function name: ensureDefaultType: It runs the check function, so checkDefault is much easier to understand. --- pkgs/lib/options.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix index f10b5831267d..a7d1a3483a08 100644 --- a/pkgs/lib/options.nix +++ b/pkgs/lib/options.nix @@ -66,18 +66,18 @@ rec { if all opt.check list then opt.merge list else - throw "One of the definitions has a bad type."; + throw "One of option ${name} values is of a bad type."; } else opt; - ensureDefaultType = opt: + checkDefault = opt: if opt ? check && opt ? default then opt // { default = if opt.check opt.default then opt.default else - throw "The default value has a bad type."; + throw "The default value of option ${name} is of a bad type."; } else opt; @@ -136,7 +136,7 @@ rec { # override settings ensureMergeInputType - ensureDefaultType + checkDefault handleOptionSets ];