Fix error formatting in unknown cases.

This commit is contained in:
Craig Everett 2023-07-04 22:38:53 +09:00
parent 7cac9d6d0d
commit 879753f8b8

View File

@ -325,13 +325,21 @@ done({error, Code}) when is_integer(Code) ->
init:stop(Code);
done({error, Reason}) ->
ok = zx_daemon:idle(),
Message = "Operation failed with: ~160tp",
ok = tell(error, Message, [Reason]),
{Message, Subs} =
case unicode:characters_to_list(Reason) of
{_, _, _} -> {"Operation failed with: ~160tp", Reason};
String -> {"Operation failed with: ~ts", String}
end,
ok = tell(error, Message, [Subs]),
init:stop(1);
done({error, Info, Code}) ->
done({error, Reason, Code}) ->
ok = zx_daemon:idle(),
Message = "Operation failed with: ~160tp",
ok = tell(error, Message, [Info]),
{Message, Subs} =
case unicode:characters_to_list(Reason) of
{_, _, _} -> {"Operation failed with: ~160tp", Reason};
String -> {"Operation failed with: ~ts", String}
end,
ok = tell(error, Message, [Subs]),
init:stop(Code);
done({error, Class, Error, Stacktrace}) ->
ok = zx_daemon:idle(),