Struct git2::Error [−][src]
pub struct Error { /* fields omitted */ }A structure to represent errors coming out of libgit2.
Methods
impl Error[src]
impl Errorpub fn last_error(code: c_int) -> Option<Error>[src]
pub fn last_error(code: c_int) -> Option<Error>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 giterr_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.
pub fn from_str(s: &str) -> Error[src]
pub fn from_str(s: &str) -> ErrorCreates a new error from the given string as the error.
The error returned will have the code GIT_ERROR and the class
GITERR_NONE.
pub fn code(&self) -> ErrorCode[src]
pub fn code(&self) -> ErrorCodeReturn 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.
pub fn class(&self) -> ErrorClass[src]
pub fn class(&self) -> ErrorClassReturn 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.
pub fn raw_code(&self) -> git_error_code[src]
pub fn raw_code(&self) -> git_error_codeReturn the raw error code associated with this error.
pub fn raw_class(&self) -> git_error_t[src]
pub fn raw_class(&self) -> git_error_tReturn the raw error class associated with this error.
pub fn message(&self) -> &str[src]
pub fn message(&self) -> &strReturn the message associated with this error
Trait Implementations
impl Debug for Error[src]
impl Debug for Errorfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl PartialEq for Error[src]
impl PartialEq for Errorfn eq(&self, other: &Error) -> bool[src]
fn eq(&self, other: &Error) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Error) -> bool[src]
fn ne(&self, other: &Error) -> boolThis method tests for !=.
impl Error for Error[src]
impl Error for Errorfn description(&self) -> &str[src]
fn description(&self) -> &strThis method is soft-deprecated. Read more
fn cause(&self) -> Option<&Error>1.0.0[src]
fn cause(&self) -> Option<&Error>The lower-level cause of this error, if any. Read more
impl Display for Error[src]
impl Display for Errorfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl From<NulError> for Error[src]
impl From<NulError> for Errorimpl From<JoinPathsError> for Error[src]
impl From<JoinPathsError> for Errorfn from(e: JoinPathsError) -> Error[src]
fn from(e: JoinPathsError) -> ErrorPerforms the conversion.