Spicy
error.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <string>
6 
7 #include <hilti/rt/extension-points.h>
8 #include <hilti/rt/result.h>
9 #include <hilti/rt/util.h>
10 
11 namespace hilti::rt::detail::adl {
12 inline std::string to_string(const result::Error& x, adl::tag /*unused*/) {
13  if ( ! x.description().empty() )
14  return fmt("<error: %s>", x.description());
15 
16  return "<error>";
17 }
18 
19 } // namespace hilti::rt::detail::adl
std::string to_string(T &&x)
Definition: extension-points.h:26
Definition: deferred-expression.h:41
std::string fmt(const char *fmt, const Args &... args)
Definition: fmt.h:13