forked from lix-project/lix
errorinfo constructor test
This commit is contained in:
parent
2d0f766a77
commit
39ff80d031
|
@ -23,6 +23,16 @@ int main()
|
||||||
logger->logEI(e.info());
|
logger->logEI(e.info());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ErrorInfo constructor
|
||||||
|
try {
|
||||||
|
auto e = Error("generic error");
|
||||||
|
throw DemoError(e.info());
|
||||||
|
} catch (Error &e) {
|
||||||
|
logger->logEI(e.info());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// For completeness sake, info through vomit levels.
|
// For completeness sake, info through vomit levels.
|
||||||
// But this is maybe a heavy format for those.
|
// But this is maybe a heavy format for those.
|
||||||
logger->logEI(
|
logger->logEI(
|
||||||
|
|
|
@ -284,7 +284,7 @@ void BinaryCacheStore::narFromPath(const StorePath & storePath, Sink & sink)
|
||||||
try {
|
try {
|
||||||
getFile(info->url, *decompressor);
|
getFile(info->url, *decompressor);
|
||||||
} catch (NoSuchBinaryCacheFile & e) {
|
} catch (NoSuchBinaryCacheFile & e) {
|
||||||
throw SubstituteGone(e.what());
|
throw SubstituteGone(e.info());
|
||||||
}
|
}
|
||||||
|
|
||||||
decompressor->finish();
|
decompressor->finish();
|
||||||
|
|
|
@ -365,7 +365,7 @@ void RemoteStore::queryPathInfoUncached(const StorePath & path,
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
// Ugly backwards compatibility hack.
|
// Ugly backwards compatibility hack.
|
||||||
if (e.msg().find("is not valid") != std::string::npos)
|
if (e.msg().find("is not valid") != std::string::npos)
|
||||||
throw InvalidPath(e.what());
|
throw InvalidPath(e.info());
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 17) {
|
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 17) {
|
||||||
|
|
|
@ -83,6 +83,7 @@ class BaseError : public std::exception
|
||||||
protected:
|
protected:
|
||||||
string prefix_; // used for location traces etc.
|
string prefix_; // used for location traces etc.
|
||||||
ErrorInfo err;
|
ErrorInfo err;
|
||||||
|
|
||||||
std::optional<string> what_;
|
std::optional<string> what_;
|
||||||
const string& calcWhat()
|
const string& calcWhat()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue