This patch improve error reporting in the Scripted Interface.
Previously, it would only log the content of the Status object and
overwrite it with the error_msg function parameter.
This patch changes that to append the Status object content to the
`error_msg` string.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
LLDBLog log_caterogy = LLDBLog::Process) {
LLDB_LOGF(GetLog(log_caterogy), "%s ERROR = %s", caller_name.data(),
error_msg.data());
- error.SetErrorString(llvm::Twine(caller_name + llvm::Twine(" ERROR = ") +
- llvm::Twine(error_msg))
- .str());
+ llvm::Twine err = llvm::Twine(caller_name + llvm::Twine(" ERROR = ") +
+ llvm::Twine(error_msg));
+ if (const char *detailed_error = error.AsCString())
+ err.concat(llvm::Twine(" (") + llvm::Twine(detailed_error) +
+ llvm::Twine(")"));
+ error.SetErrorString(err.str());
return {};
}