From af31883341a122a7285e9b4f0a034470024021eb Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 23 May 2024 14:22:07 -0700 Subject: Add a createError variant without error code (NFC) (#93209) For the significant amount of call sites that want to create an incontrovertible error, such a wrapper function creates a significant readability improvement and lowers the cost of entry to add error handling in more places. --- .../Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index ce52f35..6e676de 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -2494,8 +2494,7 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule( auto ExtendSysPath = [&](std::string directory) -> llvm::Error { if (directory.empty()) { - return llvm::make_error( - "invalid directory name", llvm::inconvertibleErrorCode()); + return llvm::createStringError("invalid directory name"); } replace_all(directory, "\\", "\\\\"); @@ -2508,10 +2507,8 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule( directory.c_str(), directory.c_str()); bool syspath_retval = ExecuteMultipleLines(command_stream.GetData(), exc_options).Success(); - if (!syspath_retval) { - return llvm::make_error( - "Python sys.path handling failed", llvm::inconvertibleErrorCode()); - } + if (!syspath_retval) + return llvm::createStringError("Python sys.path handling failed"); return llvm::Error::success(); }; -- cgit v1.1