@@ -371,36 +371,90 @@ fn find_node_by_weight<Ty: EdgeType>(
371371 Ok ( index)
372372}
373373
374- // The provided node is invalid.
375- create_exception ! ( rustworkx, InvalidNode , PyException ) ;
376- // Performing this operation would result in trying to add a cycle to a DAG.
377- create_exception ! ( rustworkx, DAGWouldCycle , PyException ) ;
378- // There is no edge present between the provided nodes.
379- create_exception ! ( rustworkx, NoEdgeBetweenNodes , PyException ) ;
380- // The specified Directed Graph has a cycle and can't be treated as a DAG.
381- create_exception ! ( rustworkx, DAGHasCycle , PyException ) ;
382- // No neighbors found matching the provided predicate.
383- create_exception ! ( rustworkx, NoSuitableNeighbors , PyException ) ;
384- // Invalid operation on a null graph
385- create_exception ! ( rustworkx, NullGraph , PyException ) ;
386- // No path was found between the specified nodes.
387- create_exception ! ( rustworkx, NoPathFound , PyException ) ;
388- // No mapping was found for the request swapping
389- create_exception ! ( rustworkx, InvalidMapping , PyException ) ;
374+ create_exception ! (
375+ rustworkx,
376+ InvalidNode ,
377+ PyException ,
378+ "The provided node is invalid."
379+ ) ;
380+ create_exception ! (
381+ rustworkx,
382+ DAGWouldCycle ,
383+ PyException ,
384+ "Performing this operation would result in trying to add a cycle to a DAG."
385+ ) ;
386+ create_exception ! (
387+ rustworkx,
388+ NoEdgeBetweenNodes ,
389+ PyException ,
390+ "There is no edge present between the provided nodes."
391+ ) ;
392+ create_exception ! (
393+ rustworkx,
394+ DAGHasCycle ,
395+ PyException ,
396+ "The specified Directed Graph has a cycle and can't be treated as a DAG."
397+ ) ;
398+ create_exception ! (
399+ rustworkx,
400+ NoSuitableNeighbors ,
401+ PyException ,
402+ "No neighbors found matching the provided predicate."
403+ ) ;
404+ create_exception ! (
405+ rustworkx,
406+ NullGraph ,
407+ PyException ,
408+ "Invalid operation on a null graph"
409+ ) ;
410+ create_exception ! (
411+ rustworkx,
412+ NoPathFound ,
413+ PyException ,
414+ "No path was found between the specified nodes."
415+ ) ;
416+ create_exception ! (
417+ rustworkx,
418+ InvalidMapping ,
419+ PyException ,
420+ "No mapping was found for the request swapping"
421+ ) ;
422+
390423// Prune part of the search tree while traversing a graph.
391424import_exception ! ( rustworkx. visit, PruneSearch ) ;
392425// Stop graph traversal.
393426import_exception ! ( rustworkx. visit, StopSearch ) ;
394- // JSON Error
395- create_exception ! ( rustworkx, JSONSerializationError , PyException ) ;
396- // JSON Error
397- create_exception ! ( rustworkx, JSONDeserializationError , PyException ) ;
398- // Negative Cycle found on shortest-path algorithm
399- create_exception ! ( rustworkx, NegativeCycle , PyException ) ;
400- // Failed to Converge on a solution
401- create_exception ! ( rustworkx, FailedToConverge , PyException ) ;
402- // Graph is not bipartite
403- create_exception ! ( rustworkx, GraphNotBipartite , PyException ) ;
427+
428+ create_exception ! (
429+ rustworkx,
430+ JSONSerializationError ,
431+ PyException ,
432+ "JSON Serialization Error"
433+ ) ;
434+ create_exception ! (
435+ rustworkx,
436+ JSONDeserializationError ,
437+ PyException ,
438+ "JSON Deserialization Error"
439+ ) ;
440+ create_exception ! (
441+ rustworkx,
442+ NegativeCycle ,
443+ PyException ,
444+ "Negative Cycle found on shortest-path algorithm"
445+ ) ;
446+ create_exception ! (
447+ rustworkx,
448+ FailedToConverge ,
449+ PyException ,
450+ "Failed to Converge on a solution"
451+ ) ;
452+ create_exception ! (
453+ rustworkx,
454+ GraphNotBipartite ,
455+ PyException ,
456+ "Graph is not bipartite"
457+ ) ;
404458
405459#[ pymodule]
406460fn rustworkx ( py : Python < ' _ > , m : & Bound < PyModule > ) -> PyResult < ( ) > {
0 commit comments