Skip to content

Commit

Permalink
Update FieldError documentation with new value literal macro
Browse files Browse the repository at this point in the history
  • Loading branch information
mhallin committed Aug 8, 2017
1 parent a97ac59 commit 6710d78
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions juniper/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ impl<T: Display> From<T> 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:
///
Expand Down

0 comments on commit 6710d78

Please sign in to comment.