-module(envoker@error). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src\\envoker\\error.gleam"). -export([to_string/1]). -export_type([env_field_error/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. -type env_field_error() :: {empty_field_error, binary()} | {missing_field_error, binary()} | {parse_field_error, binary(), binary()}. -file("src\\envoker\\error.gleam", 9). ?DOC(" Converts a structured env error into a readable message.\n"). -spec to_string(env_field_error()) -> binary(). to_string(Error) -> case Error of {empty_field_error, Field_name} -> <<<<"Empty value in '"/utf8, Field_name/binary>>/binary, "'"/utf8>>; {missing_field_error, Field_name@1} -> <<<<"Missing ENV field: '"/utf8, Field_name@1/binary>>/binary, "'."/utf8>>; {parse_field_error, Field_name@2, Expected_type} -> <<<<<<"Cannot parse '"/utf8, Field_name@2/binary>>/binary, "'. Expected type: "/utf8>>/binary, Expected_type/binary>> end.