Detailed error codes
This commit is contained in:
parent
3355ccca67
commit
3b36cb6c78
|
|
@ -182,6 +182,12 @@ impl Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the raw OpenSSL error constant for the library reporting the
|
||||||
|
/// error.
|
||||||
|
pub fn library_code(&self) -> libc::c_int {
|
||||||
|
ffi::ERR_GET_LIB(self.code)
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the name of the function reporting the error.
|
/// Returns the name of the function reporting the error.
|
||||||
pub fn function(&self) -> Option<&'static str> {
|
pub fn function(&self) -> Option<&'static str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
@ -206,6 +212,11 @@ impl Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the raw OpenSSL error constant for the reason for the error.
|
||||||
|
pub fn reason_code(&self) -> libc::c_int {
|
||||||
|
ffi::ERR_GET_REASON(self.code)
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the name of the source file which encountered the error.
|
/// Returns the name of the source file which encountered the error.
|
||||||
pub fn file(&self) -> &'static str {
|
pub fn file(&self) -> &'static str {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
@ -235,12 +246,14 @@ impl fmt::Debug for Error {
|
||||||
if let Some(library) = self.library() {
|
if let Some(library) = self.library() {
|
||||||
builder.field("library", &library);
|
builder.field("library", &library);
|
||||||
}
|
}
|
||||||
|
builder.field("library_code", &self.library_code());
|
||||||
if let Some(function) = self.function() {
|
if let Some(function) = self.function() {
|
||||||
builder.field("function", &function);
|
builder.field("function", &function);
|
||||||
}
|
}
|
||||||
if let Some(reason) = self.reason() {
|
if let Some(reason) = self.reason() {
|
||||||
builder.field("reason", &reason);
|
builder.field("reason", &reason);
|
||||||
}
|
}
|
||||||
|
builder.field("reason_code", &self.reason_code());
|
||||||
builder.field("file", &self.file());
|
builder.field("file", &self.file());
|
||||||
builder.field("line", &self.line());
|
builder.field("line", &self.line());
|
||||||
if let Some(data) = self.data() {
|
if let Some(data) = self.data() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue