[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

Samarth Narang via cfe-commits cfe-commits at lists.llvm.org
Wed May 28 17:56:06 PDT 2025


================
@@ -373,20 +370,16 @@ Example usage for a project using a compile commands database:
   // Ensure the root output directory exists.
   if (std::error_code Err = llvm::sys::fs::create_directories(OutDirectory);
       Err != std::error_code()) {
-    llvm::errs() << "Failed to create directory '" << OutDirectory << "'\n";
-    return 1;
+    ExitOnErr(llvm::createStringError(
+        llvm::inconvertibleErrorCode(), "Failed to create directory '%s': %s",
----------------
snarang181 wrote:

The string error looks verbose and explanatory to me. 
However, would you prefer me looking into the error APIs or revert this change altogether? 

https://github.com/llvm/llvm-project/pull/141699


More information about the cfe-commits mailing list