1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-20 01:09:37 +01:00

nix list-options: Ignore eval errors for now

This commit is contained in:
Eelco Dolstra 2020-09-01 13:46:39 +02:00
parent db204f40d2
commit afebbb876f

View file

@ -55,11 +55,17 @@ struct CmdListOptions : InstallableCommand
auto aValue = aFinal->value->attrs->get(option->name);
assert(aValue);
std::ostringstream str;
JSONPlaceholder jsonOut(str);
PathSet context;
printValueAsJSON(*state, true, *aValue->value, jsonOut, context);
logger->stdout(" " ANSI_BOLD "Value:" ANSI_NORMAL " %s", str.str());
try {
std::ostringstream str;
JSONPlaceholder jsonOut(str);
PathSet context;
printValueAsJSON(*state, true, *aValue->value, jsonOut, context);
logger->stdout(" " ANSI_BOLD "Value:" ANSI_NORMAL " %s", str.str());
} catch (EvalError &) {
// FIXME: should ignore "no default" errors, print
// other errors.
logger->stdout(" " ANSI_BOLD "Value:" ANSI_NORMAL " " ANSI_ITALIC "none" ANSI_NORMAL);
}
}
}
};