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 {
12 
13 namespace detail::adl {
14 inline std::string to_string(const result::Error& x, adl::tag /*unused*/) {
15  if ( ! x.description().empty() )
16  return fmt("<error: %s>", x.description());
17 
18  return "<error>";
19 }
20 
21 } // namespace detail::adl
22 
23 } // namespace hilti::rt
std::string to_string(T &&x)
Definition: extension-points.h:26
Definition: any.h:7
std::string fmt(const char *fmt, const Args &... args)
Definition: fmt.h:13