bitconch_jsonrpc_ws_server/
error.rs

1#![allow(missing_docs)]
2
3use std::io;
4
5use ws;
6
7error_chain! {
8	foreign_links {
9		Io(io::Error);
10	}
11
12	errors {
13		/// Attempted action on closed connection.
14		ConnectionClosed {
15			description("connection is closed"),
16			display("Action on closed connection."),
17		}
18	}
19}
20
21impl From<ws::Error> for Error {
22	fn from(err: ws::Error) -> Self {
23		match err.kind {
24			ws::ErrorKind::Io(e) => e.into(),
25			_ => Error::with_chain(err, "WebSockets Error"),
26		}
27	}
28}