fix: throw error when converting unknown object to lua

This commit is contained in:
Ching Pei Yang 2024-02-17 21:55:07 +01:00
parent 40b985c066
commit a57e89dece
No known key found for this signature in database
GPG Key ID: 062FBBCE1D0C5DD9
1 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
# Helpers for converting values to lua
{lib}: let
inherit (lib) mapAttrsToList filterAttrs concatStringsSep concatMapStringsSep stringToCharacters boolToString;
inherit (builtins) hasAttr head;
inherit (builtins) hasAttr head throw typeOf;
in rec {
# Convert a null value to lua's nil
nullString = value:
@ -84,5 +84,5 @@ in rec {
then "${toString args}"
else if (args == null)
then "nil"
else "";
else throw "could not convert object of type `${typeOf args}` to lua object";
}