mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
appending to hints; remove _printError
This commit is contained in:
parent
f30de61578
commit
7ffb5efdbc
4 changed files with 18 additions and 9 deletions
|
@ -26,10 +26,13 @@ int main()
|
|||
|
||||
// ErrorInfo constructor
|
||||
try {
|
||||
auto e = Error("generic error");
|
||||
auto e = Error("some error");
|
||||
throw DemoError(e.info());
|
||||
} catch (Error &e) {
|
||||
logger->logEI(e.info());
|
||||
ErrorInfo ei = e.info();
|
||||
string prevhint = (e.info().hint.has_value() ? e.info().hint->str() : "");
|
||||
ei.hint = std::optional(hintfmt("previous hint was: %s", normaltxt(prevhint)));
|
||||
logger->logEI(ei);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -488,14 +488,18 @@ void handleDiffHook(
|
|||
|
||||
auto diffRes = runProgram(diffHookOptions);
|
||||
if (!statusOk(diffRes.first))
|
||||
throw ExecError(diffRes.first, "diff-hook program '%1%' %2%", diffHook, statusToString(diffRes.first));
|
||||
throw ExecError(diffRes.first,
|
||||
"diff-hook program '%1%' %2%",
|
||||
diffHook,
|
||||
statusToString(diffRes.first));
|
||||
|
||||
if (diffRes.second != "")
|
||||
printError(chomp(diffRes.second));
|
||||
} catch (Error & error) {
|
||||
// logError(error.info())
|
||||
// TODO append message onto errorinfo...
|
||||
_printError("diff hook execution failed: %s", error.what());
|
||||
ErrorInfo ei = error.info();
|
||||
string prevhint = (error.info().hint.has_value() ? error.info().hint->str() : "");
|
||||
ei.hint = std::optional(hintfmt("diff hook execution failed: %s", prevhint));
|
||||
logError(ei);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,7 +149,6 @@ extern Verbosity verbosity; /* suppress msgs > this */
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define _printError(args...) printMsg(lvlError, args)
|
||||
#define printError(args...) printMsg(lvlError, args)
|
||||
#define printInfo(args...) printMsg(lvlInfo, args)
|
||||
#define printTalkative(args...) printMsg(lvlTalkative, args)
|
||||
|
|
|
@ -246,9 +246,12 @@ static void daemonLoop(char * * argv)
|
|||
|
||||
} catch (Interrupted & e) {
|
||||
return;
|
||||
} catch (Error & e) {
|
||||
} catch (Error & error) {
|
||||
// TODO append error message
|
||||
_printError("error processing connection: %1%", e.msg());
|
||||
ErrorInfo ei = error.info();
|
||||
string prevhint = (error.info().hint.has_value() ? error.info().hint->str() : "");
|
||||
ei.hint = std::optional(hintfmt("error processing connection: %1%", prevhint));
|
||||
logError(ei);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue