sentry_contrib_breakpad/
error.rs1use std::fmt;
2
3#[derive(Debug)]
4pub enum Error {
5 Handler(breakpad_handler::Error),
6 Io(std::io::Error),
7 NonUtf8Path(std::path::PathBuf),
9}
10
11impl std::error::Error for Error {
12 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
13 match self {
14 Self::Handler(e) => Some(e),
15 Self::Io(e) => Some(e),
16 Self::NonUtf8Path(_) => None,
17 }
18 }
19}
20
21impl fmt::Display for Error {
22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23 match self {
24 Self::Handler(e) => write!(f, "handler error: {}", e),
25 Self::Io(e) => write!(f, "io error: {}", e),
26 Self::NonUtf8Path(p) => write!(f, "{} is not a utf-8 path", p.display()),
27 }
28 }
29}
30
31impl From<breakpad_handler::Error> for Error {
32 fn from(e: breakpad_handler::Error) -> Self {
33 Self::Handler(e)
34 }
35}
36
37impl From<std::io::Error> for Error {
38 fn from(e: std::io::Error) -> Self {
39 Self::Io(e)
40 }
41}