Update FieldError documentation with new value literal macro
This commit is contained in:
parent
a97ac59135
commit
6710d780cf
1 changed files with 15 additions and 0 deletions
|
@ -109,6 +109,21 @@ impl<T: Display> From<T> for FieldError {
|
||||||
impl FieldError {
|
impl FieldError {
|
||||||
/// Construct a new error with additional data
|
/// 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
|
/// The `data` parameter will be added to the `"data"` field of the error
|
||||||
/// object in the JSON response:
|
/// object in the JSON response:
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue