tmux_error (libtmux for Erlang v0.0.1)

View Source

Explain library exceptions through Erlang's native error formatter.

The shell and erl_error:format_exception/3 call format_error/2 through EEP-54 stack metadata. Explanations supplement the original exception reason; tagged results from tmux_filter:new/2 and tmux_select:try_where/2 retain their existing structured data. Formatting performs no tmux I/O.

Only library-raised errors carry this metadata. Application callback failures retain their original class, reason and stack. Coverage errors describe missing observations; formatting never loads those observations or retries an action. Long detail values may be abbreviated in the explanation. The exception reason retains the original error data. See runtime diagnostics for the separate, bounded Logger report contract.

Summary

Functions

Return supplemental native error text, or an empty map for an unknown reason.

Functions

format_error/2

-spec format_error(term(), erlang:stacktrace()) -> #{general => unicode:chardata()}.

Return supplemental native error text, or an empty map for an unknown reason.

This is the erl_error:format_error/2 callback. It neither changes the exception nor catches it on behalf of a caller.

1> #{general := Text} = tmux_error:format_error({bad_query_limit, -1}, []), ok.
ok
2> unicode:characters_to_binary(Text).
<<"The query limit must be an integer from 0 through 65536.">>