TuningFork.Source (TuningFork v0.1.0)

Copy Markdown View Source

Evaluating typed source without diagnostics on standard error, and trimming error messages.

Summary

Functions

An exception's message trimmed to one line: file, line, caret art and snippet removed, cut to 90 characters. An empty result is "that will not read".

Run fun and return its result, dropping any compiler diagnostics it would write to standard error.

Functions

one_line(message)

@spec one_line(String.t()) :: String.t()

An exception's message trimmed to one line: file, line, caret art and snippet removed, cut to 90 characters. An empty result is "that will not read".

iex> TuningFork.Source.one_line("error: missing terminator: )")
"missing terminator: )"
iex> TuningFork.Source.one_line("")
"that will not read"

run(fun)

@spec run((-> result)) :: result when result: term()

Run fun and return its result, dropping any compiler diagnostics it would write to standard error.