mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
Remove "error:" prefix to SQLite warning message
Avoid the confusing error message "warning: error: ..." when SQLite is busy. Instead, just print "warning: ..." as the message. Fixes #6656
This commit is contained in:
parent
641b0bd746
commit
920b87f94b
|
@ -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);
|
||||
|
||||
|
|
|
@ -25,8 +25,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);
|
||||
|
|
|
@ -324,6 +324,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 {
|
||||
|
|
|
@ -257,4 +257,6 @@ inline void warn(const std::string & fs, const Args & ... args)
|
|||
|
||||
void writeToStderr(std::string_view s);
|
||||
|
||||
void removeErrorPrefix(std::string & msg);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue