Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions api/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ var (
"%w: timeout conflict",
RuntimeError,
)
// ErrJSONPathVarFromNotMatched is returned when the `var.$VAR.from`
// JSONPath expression fails to match some output results. This is a
// runtime error because we cannot continue execution after failing to
// populate the value of a variable that subsequent test specifications may
// depend on.
ErrJSONPathVarFromNotMatched = fmt.Errorf(
"%w: var.from JSONPath not matched",
RuntimeError,
)
)

// DependencyNotSatified returns an ErrDependencyNotSatisfied with the supplied
Expand Down Expand Up @@ -193,3 +202,18 @@ func TimeoutConflict(
}
return fmt.Errorf("%w: %s", ErrTimeoutConflict, msg)
}

// JSONPathVarFromNotMatched returns a RuntimeError indicating that a variable
// could not be populated due to a failure to match the variable's from
// JSONPath to expected output. This is a RuntimeError because subsequent test
// specifications may depend on the variable having been populated.
func JSONPathVarFromNotMatched(
varName string,
path string,
) error {
return fmt.Errorf(
"%w: variable %s could not be filled because "+
"JSONPath expression %s did not match output",
ErrJSONPathVarFromNotMatched, varName, path,
)
}
Loading