nix_api_util: throw nix::error instead of new nix::Error for null ctx's

This commit is contained in:
Yorick van Pelt 2023-08-04 17:44:34 +02:00 committed by José Luis Lafuente
parent e74d6c1b3d
commit f0afe7f9b9
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A

View file

@ -43,7 +43,7 @@ nix_err nix_context_error(nix_c_context *context) {
nix_err nix_set_err_msg(nix_c_context *context, nix_err err, const char *msg) {
if (context == nullptr) {
// todo last_err_code
throw new nix::Error("Nix C api error", msg);
throw nix::Error("Nix C api error: %s", msg);
}
context->last_err_code = err;
context->last_err = msg;