forked from radareorg/r2pipe.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.rs
51 lines (40 loc) · 1.4 KB
/
error.rs
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
use std::sync::mpsc::{RecvError, SendError, TryRecvError};
use std::{io, str};
use thiserror::Error;
#[cfg(feature = "http")]
use reqwest;
/// Custom `Error` for r2pipe.rs.
#[derive(Error, Debug)]
pub enum Error {
/// An I/O error occurred.
#[error("I/O error")]
Io(#[from] io::Error),
/// No open radare2 session, perhaps path was not specified.
#[error("No open session")]
NoSession,
/// Response had invalid/missing JSON.
#[error("Empty response from JSON")]
EmptyResponse,
/// Incorrect number of arguments, or incorrect format.
#[error("Argument mismatch")]
ArgumentMismatch,
/// An error occurred inside of serde.
#[error("Serde deserialization error")]
SerdeError(#[from] serde_json::Error),
/// Error during UTF-8 decoding.
#[error("UTF-8 decoding error")]
Utf8(#[from] str::Utf8Error),
/// Error receiving data from channel.
#[error("Receive channel data error")]
ChannelReceiveError(#[from] RecvError),
/// Error trying to receive data from channel.
#[error("Trying receive channel data error")]
ChannelTryReceiveError(#[from] TryRecvError),
/// Error sending data through channel.
#[error("Send channel data error")]
ChannelSendError(#[from] SendError<String>),
/// Error during reqwest operation.
#[cfg(feature = "http")]
#[error("Reqwest error")]
Reqwest(#[from] reqwest::Error),
}