spaceapi_server/
errors.rs

1//! Custom error types.
2
3use std::borrow::Cow;
4use std::io;
5
6use quick_error::quick_error;
7use r2d2::Error as R2d2Error;
8use redis::RedisError;
9
10quick_error! {
11    /// A ``SpaceapiServerError`` wraps general problems that can occur in the SpaceAPI server.
12    #[derive(Debug)]
13    pub enum SpaceapiServerError {
14        /// A problem with redis occurred.
15        Redis(err: RedisError) {
16            from()
17            source(err)
18        }
19        /// A problem with the redis connection pool occurred.
20        R2d2(err: R2d2Error) {
21            from()
22            source(err)
23        }
24        /// An I/O error occurred.
25        IoError(err: io::Error) {
26            from()
27            source(err)
28        }
29        /// Another error happened.
30        Message(err: Cow<'static, str>) {
31            display("{}", err)
32            from(s: &'static str) -> (s.into())
33            from(s: String) -> (s.into())
34        }
35    }
36}