@@ -81,6 +81,7 @@ fn exception_str(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
8181
8282#[ derive( Debug ) ]
8383pub struct ExceptionZoo {
84+ pub arithmetic_error : PyObjectRef ,
8485 pub assertion_error : PyObjectRef ,
8586 pub attribute_error : PyObjectRef ,
8687 pub base_exception_type : PyObjectRef ,
@@ -93,12 +94,14 @@ pub struct ExceptionZoo {
9394 pub name_error : PyObjectRef ,
9495 pub not_implemented_error : PyObjectRef ,
9596 pub os_error : PyObjectRef ,
97+ pub overflow_error : PyObjectRef ,
9698 pub permission_error : PyObjectRef ,
9799 pub runtime_error : PyObjectRef ,
98100 pub stop_iteration : PyObjectRef ,
99101 pub syntax_error : PyObjectRef ,
100102 pub type_error : PyObjectRef ,
101103 pub value_error : PyObjectRef ,
104+ pub zero_division_error : PyObjectRef ,
102105}
103106
104107impl ExceptionZoo {
@@ -113,6 +116,8 @@ impl ExceptionZoo {
113116
114117 let exception_type = create_type ( "Exception" , & type_type, & base_exception_type, & dict_type) ;
115118
119+ let arithmetic_error =
120+ create_type ( "ArithmeticError" , & type_type, & exception_type, & dict_type) ;
116121 let assertion_error =
117122 create_type ( "AssertionError" , & type_type, & exception_type, & dict_type) ;
118123 let attribute_error =
@@ -128,8 +133,18 @@ impl ExceptionZoo {
128133 let type_error = create_type ( "TypeError" , & type_type, & exception_type, & dict_type) ;
129134 let value_error = create_type ( "ValueError" , & type_type, & exception_type, & dict_type) ;
130135
136+ let overflow_error =
137+ create_type ( "OverflowError" , & type_type, & arithmetic_error, & dict_type) ;
138+ let zero_division_error = create_type (
139+ "ZeroDivisionError" ,
140+ & type_type,
141+ & arithmetic_error,
142+ & dict_type,
143+ ) ;
144+
131145 let module_not_found_error =
132146 create_type ( "ModuleNotFoundError" , & type_type, & import_error, & dict_type) ;
147+
133148 let not_implemented_error = create_type (
134149 "NotImplementedError" ,
135150 & type_type,
@@ -142,6 +157,7 @@ impl ExceptionZoo {
142157 let permission_error = create_type ( "PermissionError" , & type_type, & os_error, & dict_type) ;
143158
144159 ExceptionZoo {
160+ arithmetic_error,
145161 assertion_error,
146162 attribute_error,
147163 base_exception_type,
@@ -154,12 +170,14 @@ impl ExceptionZoo {
154170 name_error,
155171 not_implemented_error,
156172 os_error,
173+ overflow_error,
157174 permission_error,
158175 runtime_error,
159176 stop_iteration,
160177 syntax_error,
161178 type_error,
162179 value_error,
180+ zero_division_error,
163181 }
164182 }
165183}
0 commit comments