1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

Merge pull request #13677 from NixOS/mergify/bp/2.28-maintenance/pr-13248

libmain: Catch logger exceptions in `handleExceptions` (backport #13248)
This commit is contained in:
Sergei Zimmerman 2025-08-03 00:10:24 +03:00 committed by GitHub
commit 49062664ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -336,6 +336,7 @@ int handleExceptions(const std::string & programName, std::function<void()> fun)
ErrorInfo::programName = baseNameOf(programName);
std::string error = ANSI_RED "error:" ANSI_NORMAL " ";
try {
try {
try {
fun();
@ -363,6 +364,10 @@ int handleExceptions(const std::string & programName, std::function<void()> fun)
printError(error + e.what());
return 1;
}
} catch (...) {
/* In case logger also throws just give up. */
return 1;
}
return 0;
}