26#ifndef MYSQLSHDK_SCRIPTING_POLYGLOT_UTILS_POLYGLOT_ERROR_H_
27#define MYSQLSHDK_SCRIPTING_POLYGLOT_UTILS_POLYGLOT_ERROR_H_
57 const char *
what() const noexcept
override {
return m_message.c_str(); }
82 std::string
format(
bool include_location =
false)
const;
89 std::optional<std::string>
type()
const {
return m_type; }
100 void initialize(poly_thread thread, poly_exception exc);
115template <
typename F,
typename... Args>
117 if (
const auto rc = f(thread, std::forward<Args>(args)...); poly_ok != rc)
Represents polyglot errors that will be created from information available in the polyglot library st...
Definition: polyglot_error.h:77
Polyglot_error(poly_thread thread, int64_t rc)
Definition: polyglot_error.cc:191
std::optional< int64_t > code() const
Definition: polyglot_error.h:93
bool is_syntax_error() const
Definition: polyglot_error.cc:393
std::optional< uint64_t > column() const
Definition: polyglot_error.h:91
std::string format(bool include_location=false) const
Definition: polyglot_error.cc:397
void parse_and_translate(const std::string &source)
This function is used to normalize as much as possible the exceptions, i.e.
Definition: polyglot_error.cc:338
std::optional< size_t > m_column
Definition: polyglot_error.h:106
std::optional< uint64_t > line() const
Definition: polyglot_error.h:90
std::optional< int64_t > m_code
Definition: polyglot_error.h:108
std::optional< std::string > source() const
Definition: polyglot_error.h:94
std::optional< std::string > m_source_line
Definition: polyglot_error.h:107
shcore::Dictionary_t data() const
Definition: polyglot_error.cc:456
std::optional< std::string > source_line() const
Definition: polyglot_error.h:92
std::optional< std::string > type() const
Definition: polyglot_error.h:89
bool is_resource_exhausted() const
Definition: polyglot_error.h:85
std::vector< std::string > backtrace() const
Definition: polyglot_error.h:95
bool is_interrupted() const
Definition: polyglot_error.h:84
std::optional< std::string > m_source
Definition: polyglot_error.h:109
std::vector< std::string > m_backtrace
Definition: polyglot_error.h:110
std::optional< size_t > m_line
Definition: polyglot_error.h:105
std::optional< std::string > m_type
Definition: polyglot_error.h:104
void initialize(poly_thread thread, poly_exception exc)
Definition: polyglot_error.cc:209
void set_message(const std::string &msg) override
Definition: polyglot_error.cc:321
bool m_resource_exhausted
Definition: polyglot_error.h:112
bool m_interrupted
Definition: polyglot_error.h:111
This class is used to represent errors occurred in the polyglot library while executing one of the fu...
Definition: polyglot_error.h:53
virtual void set_message(const std::string &msg)
Definition: polyglot_error.h:63
std::string m_message
Definition: polyglot_error.h:66
Polyglot_generic_error(const std::string &msg)
Definition: polyglot_error.h:55
const std::string & message() const
Definition: polyglot_error.h:59
const char * what() const noexcept override
Definition: polyglot_error.h:57
Polyglot_generic_error()=default
#define F
Definition: jit_executor_value.cc:374
constexpr bool unlikely(bool expr)
Definition: my_compiler.h:58
shcore::polyglot::Polyglot_error Polyglot_error
Definition: jit_executor_javascript.h:53
const char * k_key_message
Definition: polyglot_error.h:43
void throw_if_error(F f, poly_thread thread, Args &&...args)
Definition: polyglot_error.h:116
Definition: file_system_exceptions.h:34
Value::Map_type_ref Dictionary_t
Definition: jit_executor_value.h:430