From 6710d780cfc96a742b501a0f91110047fdd7aa58 Mon Sep 17 00:00:00 2001 From: Magnus Hallin Date: Tue, 8 Aug 2017 22:44:20 +0200 Subject: [PATCH] Update FieldError documentation with new value literal macro --- juniper/src/executor.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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: ///