mirror of
https://github.com/NixOS/nix
synced 2025-06-25 23:11:16 +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
|
@ -66,11 +66,10 @@ static void prim_fetchTree(EvalState & state, const Pos & pos, Value * * args, V
|
|||
}
|
||||
|
||||
if (!attrs.count("type"))
|
||||
throw Error(
|
||||
ErrorInfo {
|
||||
.hint = hintfmt("attribute 'type' is missing in call to 'fetchTree'"),
|
||||
.nixCode = NixCode { .errPos = pos }
|
||||
});
|
||||
throw Error({
|
||||
.hint = hintfmt("attribute 'type' is missing in call to 'fetchTree'"),
|
||||
.nixCode = NixCode { .errPos = pos }
|
||||
});
|
||||
|
||||
input = fetchers::inputFromAttrs(attrs);
|
||||
} else
|
||||
|
@ -111,20 +110,17 @@ static void fetch(EvalState & state, const Pos & pos, Value * * args, Value & v,
|
|||
else if (n == "name")
|
||||
name = state.forceStringNoCtx(*attr.value, *attr.pos);
|
||||
else
|
||||
throw EvalError(
|
||||
ErrorInfo {
|
||||
.hint = hintfmt("unsupported argument '%s' to '%s'",
|
||||
attr.name, who),
|
||||
.nixCode = NixCode { .errPos = *attr.pos }
|
||||
});
|
||||
throw EvalError({
|
||||
.hint = hintfmt("unsupported argument '%s' to '%s'", attr.name, who),
|
||||
.nixCode = NixCode { .errPos = *attr.pos }
|
||||
});
|
||||
}
|
||||
|
||||
if (!url)
|
||||
throw EvalError(
|
||||
ErrorInfo {
|
||||
.hint = hintfmt("'url' argument required"),
|
||||
.nixCode = NixCode { .errPos = pos }
|
||||
});
|
||||
throw EvalError({
|
||||
.hint = hintfmt("'url' argument required"),
|
||||
.nixCode = NixCode { .errPos = pos }
|
||||
});
|
||||
} else
|
||||
url = state.forceStringNoCtx(*args[0], pos);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue