|
|
bool | initialized |
| | Whether this ErrorData contains an exception or not.
|
| |
|
ExceptionType | type |
| | The ExceptionType of the preserved exception.
|
| |
|
string | raw_message |
| | The message the exception was constructed with (does not contain the Exception Type)
|
| |
|
string | final_message |
| | The final message (stored in the preserved error for compatibility reasons with C-API)
|
| |
|
unordered_map< string, string > | extra_info |
| | Extra exception info.
|
| |
◆ ErrorData() [1/4]
| duckdb::ErrorData::ErrorData |
( |
| ) |
|
Not initialized, default constructor.
70132}
ExceptionType type
The ExceptionType of the preserved exception.
Definition duckdb.hpp:6547
bool initialized
Whether this ErrorData contains an exception or not.
Definition duckdb.hpp:6545
◆ ErrorData() [2/4]
| duckdb::ErrorData::ErrorData |
( |
const std::exception & |
ex | ) |
|
From std::exception.
70135}
DUCKDB_API ErrorData()
Not initialized, default constructor.
Definition duckdb.cpp:70131
◆ ErrorData() [3/4]
| duckdb::ErrorData::ErrorData |
( |
ExceptionType |
type, |
|
|
const string & |
raw_message |
|
) |
| |
From a raw string and exception type.
70139
70140
70141
70143}
string raw_message
The message the exception was constructed with (does not contain the Exception Type)
Definition duckdb.hpp:6549
string final_message
The final message (stored in the preserved error for compatibility reasons with C-API)
Definition duckdb.hpp:6551
◆ ErrorData() [4/4]
| duckdb::ErrorData::ErrorData |
( |
const string & |
raw_message | ) |
|
|
explicit |
From a raw string.
70147
70148 if (message.empty() || message[0] != '{') {
70149
70150
70151 if (message == std::bad_alloc().what()) {
70152 type = ExceptionType::OUT_OF_MEMORY;
70154 } else {
70156 }
70158 return;
70159 }
70160
70161
70163 for (auto &entry : info) {
70164 if (entry.first == "exception_type") {
70165 type = Exception::StringToExceptionType(entry.second);
70166 } else if (entry.first == "exception_message") {
70167 raw_message = SanitizeErrorMessage(entry.second);
70168 } else {
70170 }
70171 }
70173}
unordered_map< string, string > extra_info
Extra exception info.
Definition duckdb.hpp:6553
static DUCKDB_API unique_ptr< ComplexJSON > ParseJSONMap(const string &json, bool ignore_errors=false)
◆ Throw()
| void duckdb::ErrorData::Throw |
( |
const string & |
prepended_message = "" | ) |
const |
Throw the error.
70200 {
70202 if (!prepended_message.empty()) {
70203 string new_message = prepended_message +
raw_message;
70205 }
70207}
◆ Type()
| const ExceptionType & duckdb::ErrorData::Type |
( |
| ) |
const |
Get the internal exception type of the error.
◆ Message()
| DUCKDB_API const string & duckdb::ErrorData::Message |
( |
| ) |
const |
|
inline |
Used in clients like C-API, creates the final message and returns a reference to it.
◆ RawMessage()
| DUCKDB_API const string & duckdb::ErrorData::RawMessage |
( |
| ) |
const |
|
inline |
◆ Merge()
70214 {
70215 if (!other.HasError()) {
70216 return;
70217 }
70219 *this = other;
70220 return;
70221 }
70222 if (Exception::InvalidatesDatabase(other.Type()) || other.type == ExceptionType::INTERNAL) {
70223
70225 }
70227}
bool HasError() const
Returns true, if this error data contains an exception, else false.
Definition duckdb.hpp:6527
◆ operator==()
70229 {
70231 return false;
70232 }
70233 if (
type != other.type) {
70234 return false;
70235 }
70237}
◆ HasError()
| bool duckdb::ErrorData::HasError |
( |
| ) |
const |
|
inline |
Returns true, if this error data contains an exception, else false.
◆ ExtraInfo()
| const unordered_map< string, string > & duckdb::ErrorData::ExtraInfo |
( |
| ) |
const |
|
inline |
◆ FinalizeError()
| void duckdb::ErrorData::FinalizeError |
( |
| ) |
|
70248 {
70249 auto entry =
extra_info.find(
"stack_trace_pointers");
70251 auto stack_trace = StackTrace::ResolveStacktraceSymbols(entry->second);
70252 extra_info[
"stack_trace"] = std::move(stack_trace);
70254 }
70255}
◆ AddErrorLocation()
| void duckdb::ErrorData::AddErrorLocation |
( |
const string & |
query | ) |
|
70257 {
70258 if (!query.empty()) {
70263 }
70264 }
70265 {
70266 auto entry =
extra_info.find(
"stack_trace");
70267 if (entry !=
extra_info.end() && !entry->second.empty()) {
70268 raw_message +=
"\n\nStack Trace:\n" + entry->second;
70269 entry->second = "";
70270 }
70271 }
70273}
◆ ConvertErrorToJSON()
| void duckdb::ErrorData::ConvertErrorToJSON |
( |
| ) |
|
70239 {
70241
70242 return;
70243 }
70246}
static DUCKDB_API string ExceptionToJSONMap(ExceptionType type, const string &message, const unordered_map< string, string > &map)
◆ AddQueryLocation() [1/4]
70275 {
70276 Exception::SetQueryLocation(query_location,
extra_info);
70277}
◆ AddQueryLocation() [2/4]
70279 {
70280 AddQueryLocation(error_context.query_location);
70281}
◆ AddQueryLocation() [3/4]
70283 {
70284 AddQueryLocation(ref.GetQueryLocation());
70285}
◆ AddQueryLocation() [4/4]
70287 {
70288 AddQueryLocation(ref.query_location);
70289}
◆ SanitizeErrorMessage()
| string duckdb::ErrorData::SanitizeErrorMessage |
( |
string |
error | ) |
|
|
staticprivate |
70175 {
70176 return StringUtil::Replace(std::move(error), string("\0", 1), "\\0");
70177}
◆ ConstructFinalMessage()
| string duckdb::ErrorData::ConstructFinalMessage |
( |
| ) |
const |
|
private |
70179 {
70181 if (
type != ExceptionType::UNKNOWN_TYPE) {
70182 error = Exception::ExceptionTypeToString(
type) +
" ";
70183 }
70185 if (
type == ExceptionType::INTERNAL) {
70186 error +=
"\nThis error signals an assertion failure within DuckDB. This usually occurs due to "
70187 "unexpected conditions or errors in the program's logic.\nFor more information, see "
70188 "https://duckdb.org/docs/stable/dev/internal_errors";
70189
70190
70191 auto entry =
extra_info.find(
"stack_trace_pointers");
70193 auto stack_trace = StackTrace::ResolveStacktraceSymbols(entry->second);
70194 error +=
"\n\nStack Trace:\n" + stack_trace;
70195 }
70196 }
70198}
void error(int _code, const String &_err, const char *_func, const char *_file, int _line)
The documentation for this class was generated from the following files:
- external/duckdb/duckdb.hpp
- external/duckdb/duckdb.cpp