44use std:: collections:: BTreeSet ;
55
66use crate :: {
7- InvalidGraphError ,
7+ FormulaGenerationError , InvalidGraphError ,
88 category:: { category_from_python_component, match_category} ,
99 component:: Component ,
1010 connection:: Connection ,
@@ -210,21 +210,21 @@ impl ComponentGraph {
210210 self . graph
211211 . consumer_formula ( )
212212 . map ( |f| f. to_string ( ) )
213- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
213+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
214214 }
215215
216216 fn producer_formula ( & self ) -> PyResult < String > {
217217 self . graph
218218 . producer_formula ( )
219219 . map ( |f| f. to_string ( ) )
220- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
220+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
221221 }
222222
223223 fn grid_formula ( & self ) -> PyResult < String > {
224224 self . graph
225225 . grid_formula ( )
226226 . map ( |f| f. to_string ( ) )
227- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
227+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
228228 }
229229
230230 #[ pyo3( signature = ( battery_ids=None ) ) ]
@@ -236,15 +236,15 @@ impl ComponentGraph {
236236 self . graph
237237 . battery_formula ( extract_ids ( py, battery_ids) ?)
238238 . map ( |f| f. to_string ( ) )
239- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
239+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
240240 }
241241
242242 #[ pyo3( signature = ( chp_ids=None ) ) ]
243243 fn chp_formula ( & self , py : Python < ' _ > , chp_ids : Option < Bound < ' _ , PyAny > > ) -> PyResult < String > {
244244 self . graph
245245 . chp_formula ( extract_ids ( py, chp_ids) ?)
246246 . map ( |f| f. to_string ( ) )
247- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
247+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
248248 }
249249
250250 #[ pyo3( signature = ( pv_inverter_ids=None ) ) ]
@@ -256,7 +256,7 @@ impl ComponentGraph {
256256 self . graph
257257 . pv_formula ( extract_ids ( py, pv_inverter_ids) ?)
258258 . map ( |f| f. to_string ( ) )
259- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
259+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
260260 }
261261
262262 #[ pyo3( signature = ( ev_charger_ids=None ) ) ]
@@ -268,14 +268,14 @@ impl ComponentGraph {
268268 self . graph
269269 . ev_charger_formula ( extract_ids ( py, ev_charger_ids) ?)
270270 . map ( |f| f. to_string ( ) )
271- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
271+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
272272 }
273273
274274 fn grid_coalesce_formula ( & self ) -> PyResult < String > {
275275 self . graph
276276 . grid_coalesce_formula ( )
277277 . map ( |f| f. to_string ( ) )
278- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
278+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
279279 }
280280
281281 #[ pyo3( signature = ( battery_ids=None ) ) ]
@@ -287,7 +287,7 @@ impl ComponentGraph {
287287 self . graph
288288 . battery_ac_coalesce_formula ( extract_ids ( py, battery_ids) ?)
289289 . map ( |f| f. to_string ( ) )
290- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
290+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
291291 }
292292
293293 #[ pyo3( signature = ( pv_inverter_ids=None ) ) ]
@@ -299,7 +299,7 @@ impl ComponentGraph {
299299 self . graph
300300 . pv_ac_coalesce_formula ( extract_ids ( py, pv_inverter_ids) ?)
301301 . map ( |f| f. to_string ( ) )
302- . map_err ( |e| PyErr :: new :: < pyo3 :: exceptions :: PyValueError , _ > ( e. to_string ( ) ) )
302+ . map_err ( |e| PyErr :: new :: < FormulaGenerationError , _ > ( e. to_string ( ) ) )
303303 }
304304}
305305
0 commit comments