aboutsummaryrefslogtreecommitdiff
path: root/error.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2013-10-21 22:51:18 -0700
committerSteven Fackler <[email protected]>2013-10-21 22:51:18 -0700
commit302590c2b5fc75da807157073e3bd393d89b385e (patch)
treef7762682860ba7129dd3f47deef5bdcecf43addf /error.rs
parentFill out the context methods (diff)
downloadrust-openssl-302590c2b5fc75da807157073e3bd393d89b385e.tar.xz
rust-openssl-302590c2b5fc75da807157073e3bd393d89b385e.zip
Major rewrite for better error handling
Diffstat (limited to 'error.rs')
-rw-r--r--error.rs18
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))
+ }
+ }
+}