diff --git a/juniper/src/executor.rs b/juniper/src/executor.rs index e668d2fe..d26ca6c5 100644 --- a/juniper/src/executor.rs +++ b/juniper/src/executor.rs @@ -109,6 +109,21 @@ impl From for FieldError { impl FieldError { /// Construct a new error with additional data /// + /// You can use the `graphql_value!` macro to construct an error: + /// + /// ```rust + /// # #[macro_use] extern crate juniper; + /// use juniper::FieldError; + /// + /// # fn sample() { + /// FieldError::new( + /// "Could not open connection to the database", + /// graphql_value!({ "internal_error": "Connection refused" }) + /// ); + /// # } + /// # fn main() { } + /// ``` + /// /// The `data` parameter will be added to the `"data"` field of the error /// object in the JSON response: ///