1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-10-18 00:16:11 -04:00
This commit is contained in:
Jean-François Roche 2024-10-15 13:57:40 +02:00 committed by GitHub
commit f04bd20788
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 2 deletions

View file

@ -158,7 +158,12 @@ protected:
};
MakeError(SQLiteBusy, SQLiteError);
struct SQLiteBusy : SQLiteError
{
SQLiteBusy(const char *path, const char *errMsg, int errNo, int extendedErrNo, int offset, HintFmt && hf)
: SQLiteError(path, errMsg, errNo, extendedErrNo, offset, std::move(hf))
{ err.level = lvlWarn; }
};
void handleSQLiteBusy(const SQLiteBusy & e, time_t & nextWarning);

View file

@ -28,8 +28,12 @@ void throwExceptionSelfCheck()
// This stringifies the error and caches it for use by what(), or similarly by msg().
const std::string & BaseError::calcWhat() const
{
if (what_.has_value())
if (what_.has_value()) {
if (err.level == Verbosity::lvlWarn) {
removeErrorPrefix(*what_);
}
return *what_;
}
else {
std::ostringstream oss;
showErrorInfo(oss, err, loggerSettings.showTrace);

View file

@ -341,6 +341,12 @@ bool handleJSONLogMessage(const std::string & msg,
return handleJSONLogMessage(*json, act, activities, trusted);
}
void removeErrorPrefix(std::string & msg)
{
if (hasPrefix(msg, "error: "))
msg.erase(0, 7);
}
Activity::~Activity()
{
try {

View file

@ -256,4 +256,6 @@ inline void warn(const std::string & fs, const Args & ... args)
void writeToStderr(std::string_view s);
void removeErrorPrefix(std::string & msg);
}