rosrust/api/
error.rs

1pub use crate::api::naming::error as naming;
2pub use crate::rosxmlrpc::error as rosxmlrpc;
3pub use crate::rosxmlrpc::ResponseError;
4pub use crate::tcpros::error as tcpros;
5
6error_chain::error_chain! {
7    foreign_links {
8        Io(::std::io::Error);
9        FromUTF8(::std::string::FromUtf8Error);
10        Response(ResponseError);
11        SigintOverride(::ctrlc::Error);
12    }
13    links {
14        XmlRpc(rosxmlrpc::Error, rosxmlrpc::ErrorKind);
15        Tcpros(tcpros::Error, tcpros::ErrorKind);
16        Naming(naming::Error, naming::ErrorKind);
17    }
18    errors {
19        Duplicate(t: String) {
20            description("Could not add duplicate")
21            display("Could not add duplicate {}", t)
22        }
23        MismatchedType(topic: String, actual_type: String, attempted_type:String) {
24            description("Attempted to connect to topic with wrong message type")
25            display("Attempted to connect to {} topic '{}' with message type {}", actual_type, topic, attempted_type)
26        }
27        MultipleInitialization {
28            description("Cannot initialize multiple nodes")
29            display("Cannot initialize multiple nodes")
30        }
31        TimeoutError
32        BadYamlData(details: String) {
33            description("Bad YAML data provided")
34            display("Bad YAML data provided: {}", details)
35        }
36        CannotResolveName(name: String) {
37            description("Failed to resolve name")
38            display("Failed to resolve name: {}", name)
39        }
40        CommunicationIssue(details: String) {
41            description("Failure in communication with ROS API")
42            display("Failure in communication with ROS API: {}", details)
43        }
44    }
45}
46
47pub mod api {
48    error_chain::error_chain! {
49        errors {
50            SystemFail(message: String) {
51                description("Failure to handle API call")
52                display("Failure to handle API call: {}", message)
53            }
54            BadData(message: String) {
55                description("Bad parameters provided in API call")
56                display("Bad parameters provided in API call: {}", message)
57            }
58        }
59    }
60}