1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use graphql_parser::Pos;
use std::fmt::Debug;

#[derive(Debug)]
pub struct ValidationErrorContext {
    pub errors: Vec<ValidationError>,
}

impl ValidationErrorContext {
    pub fn new() -> ValidationErrorContext {
        ValidationErrorContext { errors: vec![] }
    }

    pub fn report_error(&mut self, error: ValidationError) {
        self.errors.push(error);
    }
}

#[derive(Debug)]
pub struct ValidationError {
    pub locations: Vec<Pos>,
    pub message: String,
}