aboutsummaryrefslogtreecommitdiffstats
path: root/src/error.rs
blob: 22590151e16b36c7e305583d5d5e4bc062feaed4 (plain) (blame)
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
/// Errors returned by the process stream.
#[derive(Debug, snafu::Snafu)]
#[snafu(visibility(pub))]
pub enum Error {
    /// failed to open a pty
    #[snafu(display("failed to open a pty: {}", source))]
    OpenPty { source: std::io::Error },

    /// failed to poll for process exit
    #[snafu(display("failed to poll for process exit: {}", source))]
    ProcessExitPoll { source: std::io::Error },

    /// failed to read from pty
    #[snafu(display("failed to read from pty: {}", source))]
    ReadPty { source: std::io::Error },

    /// failed to read from terminal
    #[snafu(display("failed to read from terminal: {}", source))]
    ReadTerminal { source: std::io::Error },

    /// failed to resize pty
    #[snafu(display("failed to resize pty: {}", source))]
    ResizePty { source: std::io::Error },

    #[snafu(display("failed to poll for terminal resizing: {}", source))]
    Resize {
        source: tokio_terminal_resize::Error,
    },

    /// failed to spawn process
    #[snafu(display("failed to spawn process for `{}`: {}", cmd, source))]
    SpawnProcess { cmd: String, source: std::io::Error },

    /// failed to write to pty
    #[snafu(display("failed to write to pty: {}", source))]
    WritePty { source: std::io::Error },
}