File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,8 @@ pub enum ValidationError {
146146 I33IsNegative ,
147147}
148148
149+ impl core:: error:: Error for ValidationError { }
150+
149151impl Display for ValidationError {
150152 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> core:: fmt:: Result {
151153 match self {
Original file line number Diff line number Diff line change @@ -109,6 +109,15 @@ impl Display for RuntimeError {
109109 }
110110}
111111
112+ impl core:: error:: Error for RuntimeError {
113+ fn source ( & self ) -> Option < & ( dyn core:: error:: Error + ' static ) > {
114+ match self {
115+ RuntimeError :: Trap ( trap_err) => Some ( trap_err) ,
116+ _ => None ,
117+ }
118+ }
119+ }
120+
112121#[ derive( Debug , PartialEq , Eq , Clone ) ]
113122pub enum TrapError {
114123 DivideBy0 ,
@@ -160,6 +169,8 @@ impl Display for TrapError {
160169 }
161170}
162171
172+ impl core:: error:: Error for TrapError { }
173+
163174impl From < TrapError > for RuntimeError {
164175 fn from ( value : TrapError ) -> Self {
165176 Self :: Trap ( value)
You can’t perform that action at this time.
0 commit comments