nihed-cros-libva: use simple error enum instead of anyhow crate
[nihav-player.git] / nihed-cros-libva / src / generic_value.rs
index 3900edc97b292fda9cf4fd1777fe2e3c7f1641e4..989773d1cfe84fecfd28b9a41071180c50dc226a 100644 (file)
@@ -2,10 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-use anyhow::anyhow;
-use anyhow::Result;
-
 use crate::bindings;
+use crate::status::VAError;
 
 /// A wrapper over `VAGenericValue` giving us safe access to the underlying union members.
 #[derive(Debug)]
@@ -21,7 +19,7 @@ pub enum GenericValue {
 }
 
 impl TryFrom<bindings::VAGenericValue> for GenericValue {
-    type Error = anyhow::Error;
+    type Error = VAError;
 
     fn try_from(value: bindings::VAGenericValue) -> Result<Self, Self::Error> {
         // Safe because we check the type before accessing the union.
@@ -39,10 +37,7 @@ impl TryFrom<bindings::VAGenericValue> for GenericValue {
             bindings::VAGenericValueType::VAGenericValueTypeFunc => {
                 Ok(Self::Func(unsafe { value.value.fn_ }))
             }
-            other => Err(anyhow!(
-                "Conversion failed for unexpected VAGenericValueType: {}",
-                other
-            )),
+            _other => Err(VAError::InvalidValue),
         }
     }
 }