Skip to content

Commit 173435b

Browse files
committed
Expose current executor's location
`Executor` has a `push_error` method which is very useful for reporting back errors. However, this method needs to know the location of the error (`SourcePosition`). This commit adds a `location` method to the executor.
1 parent aa2ff97 commit 173435b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

juniper/src/executor.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ impl<'a, CtxT> Executor<'a, CtxT> {
254254
self.fragments.get(name).map(|f| *f)
255255
}
256256

257+
/// The current location of the executor
258+
pub fn location(&self) -> &SourcePosition {
259+
self.field_path.location()
260+
}
261+
257262
/// Add an error to the execution engine
258263
pub fn push_error(&self, error: String, location: SourcePosition) {
259264
let mut path = Vec::new();

0 commit comments

Comments
 (0)