45 void note(
const std::string &tag,
const std::string &msg)
const
47 note(tag, std::vector{msg});
60 virtual void note(
const std::string &tag,
const std::vector<std::string> &lines)
const = 0;
72 void warn_note(
const std::string &tag,
const std::string &msg)
const
87 virtual void warn_note(
const std::string &tag,
const std::vector<std::string> &lines)
const = 0;
99 void warn(
const std::string &tag,
const std::string &msg)
const
101 warn(tag, std::vector{msg});
114 virtual void warn(
const std::string &tag,
const std::vector<std::string> &lines)
const = 0;
145 void err(
const std::string &tag,
const std::string &msg)
const
147 err(tag, std::vector{msg});
160 virtual void err(
const std::string &tag,
const std::vector<std::string> &lines)
const = 0;
216 template <
typename T,
typename E>
220 const auto &chain = result.
chain();
225 auto filtered_view = chain | std::views::filter([](
const auto &
err) {
227 if (formattable_err ==
nullptr) {
233 std::vector<const Error *> filtered_chain;
234 for (
const auto &
err : filtered_view) {
235 filtered_chain.push_back(
err.get());
239 if (filtered_chain.empty()) {
240 panic(
"filtered error chain was empty, there should always be at least one FormattableError with details");
244 if (filtered_chain.size() > 1) {
246 const auto middle_range =
247 std::ranges::views::drop(filtered_chain, 1) | std::ranges::views::take(filtered_chain.size() - 2);
248 for (
const auto *
err : middle_range) {
A result type that maintains a chainable sequence of errors for debugging and error reporting.
const std::vector< std::unique_ptr< Error > > & chain() const
Returns the complete error chain.
bool has_value() const
Checks whether the result contains a success value.
Abstract interface for all error types used in ChainableResult error chains.
Abstract interface for structured error reporting and diagnostic output.
void fatal(const ChainableResult< T, E > &result) const
Display a fatal error with complete error chain visualization.
virtual void emit_fatal_proximate(const Error &err) const =0
Emit the proximate (immediate) error in a fatal error chain.
virtual void warn(const std::string &tag, const std::vector< std::string > &lines) const =0
Display a multi-line tagged warning message.
virtual void note(const std::string &tag, const std::vector< std::string > &lines) const =0
Display a multi-line tagged informational note message.
virtual void emit_fatal_root(const Error &err) const =0
Emit the root cause error in a fatal error chain.
virtual void warn_note(const std::string &tag, const std::vector< std::string > &lines) const =0
Display a multi-line tagged warning note message.
void err(const std::string &tag, const std::string &msg) const
Display a tagged error message.
void warn(const std::string &tag, const std::string &msg) const
Display a tagged warning message.
void note(const std::string &tag, const std::string &msg) const
Display a tagged informational note message.
virtual ~UserDiagnostics()=default
virtual void err(const std::string &tag, const std::vector< std::string > &lines) const =0
Display a multi-line tagged error message.
void warn_note(const std::string &tag, const std::string &msg) const
Display a note message with a warning tag.
virtual void emit_fatal_step(const Error &err) const =0
Emit an intermediate step error in a fatal error chain.
void panic(const StringViewSourceLoc &s)
Unconditionally terminates the program with a panic message.
void assert_or_panic(const bool condition, const StringViewSourceLoc &s)
Conditionally panics if the given condition is false.