forked from mirrors/jj
revset: use common argument error instead of FsPathParseError
It's not special compared to the other argument errors, and we can now track the error source separately.
This commit is contained in:
parent
074e6e12bc
commit
916dc30828
2 changed files with 6 additions and 5 deletions
|
@ -153,14 +153,14 @@ fn test_bad_function_call() {
|
|||
|
||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", r#"file(a, "../out")"#]);
|
||||
insta::assert_snapshot!(stderr.replace('\\', "/"), @r###"
|
||||
Error: Failed to parse revset: Invalid file pattern
|
||||
Error: Failed to parse revset: Function "file": Invalid file pattern
|
||||
Caused by:
|
||||
1: --> 1:9
|
||||
|
|
||||
1 | file(a, "../out")
|
||||
| ^------^
|
||||
|
|
||||
= Invalid file pattern
|
||||
= Function "file": Invalid file pattern
|
||||
2: Path "../out" is not in the repo "."
|
||||
3: Invalid component ".." in repo-relative path "../out"
|
||||
"###);
|
||||
|
|
|
@ -178,8 +178,6 @@ pub enum RevsetParseErrorKind {
|
|||
},
|
||||
#[error(r#"Function "{name}": {message}"#)]
|
||||
InvalidFunctionArguments { name: String, message: String },
|
||||
#[error("Invalid file pattern")]
|
||||
FsPathParseError,
|
||||
#[error("Cannot resolve file pattern without workspace")]
|
||||
FsPathWithoutWorkspace,
|
||||
#[error(r#"Cannot resolve "@" without workspace"#)]
|
||||
|
@ -1272,7 +1270,10 @@ static BUILTIN_FUNCTION_MAP: Lazy<HashMap<&'static str, RevsetFunction>> = Lazy:
|
|||
let path = RepoPathBuf::parse_fs_path(ctx.cwd, ctx.workspace_root, needle)
|
||||
.map_err(|e| {
|
||||
RevsetParseError::with_span_and_source(
|
||||
RevsetParseErrorKind::FsPathParseError,
|
||||
RevsetParseErrorKind::InvalidFunctionArguments {
|
||||
name: name.to_owned(),
|
||||
message: "Invalid file pattern".to_owned(),
|
||||
},
|
||||
span,
|
||||
e,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue