aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-09-20 17:52:53 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-09-20 17:52:53 +0200
commitf51ace4c7885fa25c146c24181c4d87f5632de3e (patch)
treefa22f137deaabbc99c2f7bbeb1958b07ab7c2949 /src/lib.rs
parent907d7621bc9822c2688d1783a5805f8532a92b42 (diff)
parent82bb047fda3912489d024dbf40613168ded50527 (diff)
downloadglutin-f51ace4c7885fa25c146c24181c4d87f5632de3e.tar.gz
glutin-f51ace4c7885fa25c146c24181c4d87f5632de3e.zip
Merge pull request #602 from tomaka/api-dispatch-error
[Breaking change] Better error handling in Linux's api dispatch
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 94cd445..24913fb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -106,11 +106,12 @@ pub trait GlContext {
}
/// Error that can happen while creating a window or a headless renderer.
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Debug)]
pub enum CreationError {
OsError(String),
/// TODO: remove this error
NotSupported,
+ NoBackendAvailable(Box<std::error::Error + Send>),
RobustnessNotSupported,
OpenGlVersionNotSupported,
NoAvailablePixelFormat,
@@ -121,6 +122,7 @@ impl CreationError {
match *self {
CreationError::OsError(ref text) => &text,
CreationError::NotSupported => "Some of the requested attributes are not supported",
+ CreationError::NoBackendAvailable(_) => "No backend is available",
CreationError::RobustnessNotSupported => "You requested robustness, but it is \
not supported.",
CreationError::OpenGlVersionNotSupported => "The requested OpenGL version is not \
@@ -141,6 +143,13 @@ impl std::error::Error for CreationError {
fn description(&self) -> &str {
self.to_string()
}
+
+ fn cause(&self) -> Option<&std::error::Error> {
+ match *self {
+ CreationError::NoBackendAvailable(ref err) => Some(&**err),
+ _ => None
+ }
+ }
}
/// Error that can happen when manipulating an OpenGL context.