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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! The error type used throughout this crate.

use glib;
use snafu::Backtrace;

/// The error type.
#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum Error {
    /// An error from the glib crate.
    #[snafu(display("GLib error: {:?}", source))]
    GLib {
        /// The source error.
        source: glib::Error,

        /// The backtrace.
        backtrace: Backtrace,
    },

    /// A bool error from the glib crate.
    #[snafu(display("GLib Bool error: {:?}", source))]
    GLibBool {
        /// The source error.
        source: glib::BoolError,

        /// The backtrace.
        backtrace: Backtrace,
    },

    /// An error in the OMMUI data crate.
    #[snafu(display("OMMUI data error: {:?}", source))]
    OmmuiData {
        /// The source error.
        #[snafu(backtrace)]
        source: ommui_data::Error,
    },

    /// An error when communicating with dbus.
    #[snafu(display("DBus error: {:?}", source))]
    DBus {
        /// The source error.
        source: dbus::Error,
        /// The backtrace.
        backtrace: Backtrace,
    },

    /// Couldn't run the remote support command.
    #[snafu(display(
        "Couldn't run remote support command: {:?}",
        source
    ))]
    RemoteSupportCommandIoError {
        /// The source error.
        source: std::io::Error,
        /// The backtrace.
        backtrace: Backtrace,
    },

    /// Remote support command exited with error status.
    #[snafu(display(
        "Remote support command failed with exit status {:?}.\n\n\
         stderr:\n{:?}\n\nstdout:\n{:?}",
        status,
        stderr,
        stdout
    ))]
    RemoteSupportCommandExited {
        /// The exit status
        status: std::process::ExitStatus,
        /// The stderr output.
        stderr: String,
        /// The stdout output.
        stdout: String,
        /// The backtrace.
        backtrace: Backtrace,
    },
}