Enum gpp::Error[][src]

pub enum Error {
    InvalidCommand {
        command_name: String,
    },
    TooManyParameters {
        command: &'static str,
    },
    UnexpectedCommand {
        command: &'static str,
    },
    ChildFailed {
        status: ExitStatus,
    },
    PipeFailed,
    IoError(Error),
    FromUtf8Error(FromUtf8Error),
    FileError {
        filename: String,
        line: usize,
        error: Box<Error>,
    },
}
Expand description

Error enum for parsing errors.

Examples

let error = gpp::Error::TooManyParameters { command: "my_command" };
assert_eq!(format!("{}", error), "Too many parameters for #my_command");
let error = gpp::Error::FileError {
    filename: "my_file".to_string(),
    line: 10,
    error: Box::new(gpp::Error::UnexpectedCommand {
        command: "this_command",
    }),
};
assert_eq!(format!("{}", error), "Error in my_file:10: Unexpected command #this_command");

Variants

InvalidCommand

An unknown command was encountered.

Fields of InvalidCommand

command_name: String
TooManyParameters

Too many parameters were given for a command (for example using #endif with parameters).

Fields of TooManyParameters

command: &'static str
UnexpectedCommand

There was an unexpected command; currently only generated for unexpected #endins.

Fields of UnexpectedCommand

command: &'static str
ChildFailed

The child process for an #exec exited with a nonzero status.

Fields of ChildFailed

status: ExitStatus
PipeFailed

A pipe was unable to be set up to the child.

IoError(Error)

An error with I/O occurred.

Tuple Fields of IoError

0: Error
FromUtf8Error(FromUtf8Error)

An error occurred parsing a child’s standard output as UTF-8.

Tuple Fields of FromUtf8Error

0: FromUtf8Error
FileError

An error occurred in another file.

Fields of FileError

filename: Stringline: usizeerror: Box<Error>

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.