diff options
author | Jacob Abel <jacobabel@nullpo.dev> | 2022-07-08 20:17:44 -0400 |
---|---|---|
committer | Jacob Abel <jacobabel@nullpo.dev> | 2022-10-23 17:50:24 -0400 |
commit | 88b18dcf445a1be963a6bd2f9e8c075edd668f71 (patch) | |
tree | 7840d6ec045e62e1b017ae4a55b7234ba388884b /lib | |
parent | 39a4ab78a1245eb45d333fc14ec56f3a8f045986 (diff) |
lib/strings: Improve error message for octal ambiguity in toInt
Diffstat (limited to 'lib')
-rw-r--r-- | lib/strings.nix | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/strings.nix b/lib/strings.nix index 368ec786d6703..5c5507b597b6a 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -800,8 +800,7 @@ rec { => 123 toInt "00024" - => error: [json.exception.parse_error.101] parse error at line 1, column 2: syntax error - while parsing value - unexpected number literal; expected end of input + => error: Ambiguity in interpretation of 00024 between octal and zero padded integer. toInt "3.14" => error: floating point JSON numbers are not supported @@ -821,7 +820,7 @@ rec { parsedInput = fromJSON (elemAt strippedInput 0); in if isLeadingZero - then throw "Ambiguity in ${str} between octal and zero padded integer." + then throw "Ambiguity in interpretation of ${str} between octal and zero padded integer." else if strippedInput != null && isInt parsedInput then parsedInput else throw "Could not convert ${str} to int."; |