mirror of
https://github.com/NixOS/nix
synced 2025-06-29 06:21:14 +02:00
Get rid of explicit ErrorInfo constructors
This commit is contained in:
parent
fd64e4fb96
commit
1fb762d11f
19 changed files with 360 additions and 447 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
/*
|
||||
/*
|
||||
|
||||
This file defines two main structs/classes used in nix error handling.
|
||||
|
||||
|
@ -106,7 +106,7 @@ protected:
|
|||
|
||||
mutable std::optional<string> what_;
|
||||
const string& calcWhat() const;
|
||||
|
||||
|
||||
public:
|
||||
unsigned int status = 1; // exit status
|
||||
|
||||
|
@ -119,9 +119,9 @@ public:
|
|||
{ }
|
||||
|
||||
template<typename... Args>
|
||||
BaseError(const Args & ... args)
|
||||
BaseError(const std::string & fs, const Args & ... args)
|
||||
: err { .level = lvlError,
|
||||
.hint = hintfmt(args...)
|
||||
.hint = hintfmt(fs, args...)
|
||||
}
|
||||
{ }
|
||||
|
||||
|
@ -131,7 +131,11 @@ public:
|
|||
}
|
||||
{ }
|
||||
|
||||
BaseError(ErrorInfo e)
|
||||
BaseError(ErrorInfo && e)
|
||||
: err(std::move(e))
|
||||
{ }
|
||||
|
||||
BaseError(const ErrorInfo & e)
|
||||
: err(e)
|
||||
{ }
|
||||
|
||||
|
|
|
@ -52,10 +52,10 @@ size_t threshold = 256 * 1024 * 1024;
|
|||
|
||||
static void warnLargeDump()
|
||||
{
|
||||
logWarning(ErrorInfo {
|
||||
logWarning({
|
||||
.name = "Large path",
|
||||
.description = "dumping very large path (> 256 MiB); this may run out of memory"
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue