mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Report OOM errors better
This commit is contained in:
parent
a5fb4b5b7c
commit
28e0742966
2 changed files with 8 additions and 1 deletions
|
@ -303,6 +303,9 @@ int main(int argc, char * * argv)
|
|||
if (e.prefix() != "" && !showTrace)
|
||||
printMsg(lvlError, "(use `--show-trace' to show detailed location information)");
|
||||
return e.status;
|
||||
} catch (std::bad_alloc & e) {
|
||||
printMsg(lvlError, "error: out of memory");
|
||||
return 1;
|
||||
} catch (std::exception & e) {
|
||||
printMsg(lvlError, format("error: %1%") % e.what());
|
||||
return 1;
|
||||
|
|
|
@ -731,6 +731,10 @@ static void processConnection(bool trusted)
|
|||
if (!errorAllowed) printMsg(lvlError, format("error processing client input: %1%") % e.msg());
|
||||
stopWork(false, e.msg(), GET_PROTOCOL_MINOR(clientVersion) >= 8 ? e.status : 0);
|
||||
if (!errorAllowed) break;
|
||||
} catch (std::bad_alloc & e) {
|
||||
if (canSendStderr)
|
||||
stopWork(false, "Nix daemon out of memory", GET_PROTOCOL_MINOR(clientVersion) >= 8 ? 1 : 0);
|
||||
throw;
|
||||
}
|
||||
|
||||
to.flush();
|
||||
|
@ -893,7 +897,7 @@ static void daemonLoop()
|
|||
processConnection(trusted);
|
||||
|
||||
} catch (std::exception & e) {
|
||||
writeToStderr("child error: " + string(e.what()) + "\n");
|
||||
writeToStderr("unexpected Nix daemon error: " + string(e.what()) + "\n");
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue