File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ pub enum Error {
7575 IntConversion ( TryFromIntError ) ,
7676 InvalidUtf8 ,
7777 UnexpectedNullPtr ,
78+ UnknownEnumVariant ,
7879}
7980
8081impl fmt:: Display for Error {
@@ -91,6 +92,7 @@ impl fmt::Display for Error {
9192 f,
9293 "An FFI function call returned a null ptr when we expected a non-null ptr"
9394 ) ,
95+ Error :: UnknownEnumVariant => write ! ( f, "unknown enum variant provided" ) ,
9496 }
9597 }
9698}
Original file line number Diff line number Diff line change @@ -257,13 +257,13 @@ macro_rules! from_enum {
257257 }
258258
259259 impl TryFrom <$c_type> for $name {
260- type Error = ( ) ;
260+ type Error = Error ;
261261
262262 #[ allow( non_upper_case_globals) ]
263263 fn try_from( value: $c_type) -> Result <Self , Self :: Error > {
264264 match value {
265265 $( $value => Ok ( Self :: $field) , ) *
266- _ => Err ( ( ) )
266+ _ => Err ( Error :: UnknownEnumVariant )
267267 }
268268 }
269269 }
You can’t perform that action at this time.
0 commit comments