1 #ifndef SIMDJSON_ERROR_H
2 #define SIMDJSON_ERROR_H
4 #include "simdjson/common_defs.h"
30 UNSUPPORTED_ARCHITECTURE,
52 inline const char *error_message(error_code error) noexcept;
57 inline std::ostream& operator<<(std::ostream& out, error_code error) noexcept;
69 const char *
what() const noexcept {
return error_message(
error()); }
71 error_code
error() const noexcept {
return _error; }
100 struct simdjson_result_base :
public std::pair<T, error_code> {
105 really_inline simdjson_result_base() noexcept;
110 really_inline simdjson_result_base(error_code error) noexcept;
115 really_inline simdjson_result_base(T &&value) noexcept;
120 really_inline simdjson_result_base(T &&value, error_code error) noexcept;
125 really_inline
void tie(T &value, error_code &error) && noexcept;
130 really_inline error_code error() const noexcept;
132 #if SIMDJSON_EXCEPTIONS
139 really_inline T& value() noexcept(false);
146 really_inline T&& take_value() && noexcept(false);
153 really_inline operator T&&() && noexcept(false);
155 #endif // SIMDJSON_EXCEPTIONS
187 really_inline
void tie(T& t, error_code & e) && noexcept;
192 really_inline error_code
error()
const noexcept;
194 #if SIMDJSON_EXCEPTIONS
201 really_inline T&
value() noexcept(
false);
208 really_inline T&&
take_value() && noexcept(
false);
215 really_inline
operator T&&() && noexcept(
false);
217 #endif // SIMDJSON_EXCEPTIONS
223 using ErrorValues [[deprecated(
"This is an alias and will be removed, use error_code instead")]] = error_code;
228 [[deprecated(
"Error codes should be stored and returned as `error_code`, use `error_message()` instead.")]]
229 inline const std::string &error_message(
int error) noexcept;
233 #endif // SIMDJSON_ERROR_H