Fix handle_down error message (#2)

* Fix handle_down error message

It was printing a tuple with `~s`, and also tried to pretty print a fat
call stack more than a hundred columns into the first line, which put
together made for some confusing exception-during-error-handling
messages in the erlang console.

* Switch to unicode formatting in handle_down
This commit is contained in:
Spivee
2023-05-01 13:37:53 +09:00
committed by GitHub
parent ab812e4285
commit e8c0242d19
+5 -3
View File
@@ -189,9 +189,11 @@ handle_down(PID, Mon, Info, State = #s{fetchers = Fetchers}) ->
{value, #fetcher{time = Time, node = Node, from = From, req = R}, Remaining} -> {value, #fetcher{time = Time, node = Node, from = From, req = R}, Remaining} ->
TS = calendar:system_time_to_rfc3339(Time, [{unit, nanosecond}]), TS = calendar:system_time_to_rfc3339(Time, [{unit, nanosecond}]),
Format = Format =
"ERROR ~s: Fetcher process ~p making request to ~p exited with ~p~n" "ERROR ~ts: Fetcher process ~130tp exited while making request to ~130tp~n"
"Request contents:~n~n" "Exit reason:~n"
"~s", "~tp~n"
"Request contents:~n"
"~tp~n~n",
Formatted = io_lib:format(Format, [TS, PID, Node, Info, R]), Formatted = io_lib:format(Format, [TS, PID, Node, Info, R]),
Message = unicode:characters_to_list(Formatted), Message = unicode:characters_to_list(Formatted),
ok = gen_server:reply(From, {error, Message}), ok = gen_server:reply(From, {error, Message}),