1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use codeviz_common::errors as codeviz;
use reproto_core::{ErrorPos, RpTypeId};
use reproto_core::errors as core;
use reproto_parser::errors as parser;
use reproto_repository::errors as repository;
use serde_json as json;
error_chain! {
links {
Parser(parser::Error, parser::ErrorKind);
Core(core::Error, core::ErrorKind);
Codeviz(codeviz::Error, codeviz::ErrorKind);
Repository(repository::Error, repository::ErrorKind);
}
foreign_links {
BorrowMutError(::std::cell::BorrowMutError);
Io(::std::io::Error);
Fmt(::std::fmt::Error);
Json(json::Error);
}
errors {
Pos(message: String, pos: ErrorPos) {
description("position error")
display("{}", message)
}
Errors(errors: Vec<Error>) {
description("errors")
display("encountered {} error(s)", errors.len())
}
MissingBackend {
}
MissingRequired(names: Vec<String>, pos: ErrorPos, fields: Vec<ErrorPos>) {
description("missing required")
}
RegisteredTypeConflict(type_id: RpTypeId) {
description("registered type conflict")
display("registered type conflict with: {}", type_id)
}
}
}
impl Error {
pub fn pos(message: String, pos: ErrorPos) -> Error {
ErrorKind::Pos(message, pos).into()
}
}