lightstreamer_client/
error.rs

1use std::error::Error;
2use std::fmt;
3
4#[derive(Debug)]
5pub struct IllegalArgumentException(String);
6
7impl IllegalArgumentException {
8    pub fn new(msg: &str) -> IllegalArgumentException {
9        IllegalArgumentException(msg.to_string())
10    }
11}
12
13impl fmt::Display for IllegalArgumentException {
14    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15        write!(f, "{}", self.0)
16    }
17}
18
19impl Error for IllegalArgumentException {
20    fn description(&self) -> &str {
21        &self.0
22    }
23}
24
25#[derive(Debug)]
26pub struct IllegalStateException {
27    details: String,
28}
29
30impl IllegalStateException {
31    pub fn new(msg: &str) -> IllegalStateException {
32        IllegalStateException {
33            details: msg.to_string(),
34        }
35    }
36}
37
38impl fmt::Display for IllegalStateException {
39    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
40        write!(f, "{}", self.details)
41    }
42}
43
44impl Error for IllegalStateException {
45    fn description(&self) -> &str {
46        &self.details
47    }
48}