diff options
| author | Steven Fackler <[email protected]> | 2013-10-21 22:51:18 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2013-10-21 22:51:18 -0700 |
| commit | 302590c2b5fc75da807157073e3bd393d89b385e (patch) | |
| tree | f7762682860ba7129dd3f47deef5bdcecf43addf /error.rs | |
| parent | Fill out the context methods (diff) | |
| download | rust-openssl-302590c2b5fc75da807157073e3bd393d89b385e.tar.xz rust-openssl-302590c2b5fc75da807157073e3bd393d89b385e.zip | |
Major rewrite for better error handling
Diffstat (limited to 'error.rs')
| -rw-r--r-- | error.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/error.rs b/error.rs new file mode 100644 index 00000000..b5fe0b6b --- /dev/null +++ b/error.rs @@ -0,0 +1,18 @@ +use std::libc::c_ulong; + +use super::ffi; + +pub enum SslError { + StreamEof, + SslSessionClosed, + UnknownError(c_ulong) +} + +impl SslError { + pub fn get() -> Option<SslError> { + match unsafe { ffi::ERR_get_error() } { + 0 => None, + err => Some(UnknownError(err)) + } + } +} |