@@ -53,6 +53,22 @@ pub enum Error {
5353 /// Name of the variable
5454 name : ConstString ,
5555 } ,
56+
57+ /// An external error when setting the variable.
58+ EnvVarSet {
59+ /// Name of the variable
60+ name : ConstString ,
61+ /// Cause of error
62+ cause : ConstString ,
63+ } ,
64+
65+ /// An error when casting the type of the variable.
66+ EnvVarTypeCast {
67+ /// Name of the variable
68+ name : ConstString ,
69+ /// Expected type ofthe variable
70+ var_type : ConstString ,
71+ } ,
5672}
5773
5874impl core:: error:: Error for Error {
@@ -74,6 +90,8 @@ impl core::fmt::Debug for Error {
7490 Self :: EnvVarNotDefined { name } => write ! ( f, "EnvVarNotDefined({name})" ) ,
7591 Self :: EnvVarUnknownType { name } => write ! ( f, "EnvVarlUnknownTType({name})" ) ,
7692 Self :: EnvVarWrongType { name } => write ! ( f, "EnvVarWrongType({name})" ) ,
93+ Self :: EnvVarSet { name, cause } => write ! ( f, "EnvVarSet({name}, {cause})" ) ,
94+ Self :: EnvVarTypeCast { name, var_type } => write ! ( f, "EnvVarTypeCast({name}, {var_type})" ) ,
7795 }
7896 }
7997}
@@ -92,6 +110,10 @@ impl core::fmt::Display for Error {
92110 "the type of the environment variable {name} does not match its former definition"
93111 )
94112 }
113+ Self :: EnvVarSet { name, cause } => {
114+ write ! ( f, "setting environment variable {name} failed: {cause}" )
115+ }
116+ Self :: EnvVarTypeCast { name, var_type } => write ! ( f, "cast of variable {name} to {var_type} failed" ) ,
95117 }
96118 }
97119}
0 commit comments