Struct git2::Error[][src]

pub struct Error { /* fields omitted */ }
Expand description

A structure to represent errors coming out of libgit2.

Implementations

Returns the last error that happened with the code specified by code.

The code argument typically comes from the return value of a function call. This code will later be returned from the code function.

Historically this function returned Some or None based on the return value of git_error_last but nowadays it always returns Some so it’s safe to unwrap the return value. This API will change in the next major version.

Creates a new error from the given string as the error.

The error returned will have the code GIT_ERROR and the class GIT_ERROR_NONE.

Return the error code associated with this error.

An error code is intended to be programmatically actionable most of the time. For example the code GIT_EAGAIN indicates that an error could be fixed by trying again, while the code GIT_ERROR is more bland and doesn’t convey anything in particular.

Return the error class associated with this error.

Error classes are in general mostly just informative. For example the class will show up in the error message but otherwise an error class is typically not directly actionable.

Return the raw error code associated with this error.

Return the raw error class associated with this error.

Return the message associated with this error

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

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.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.