66use std:: sync:: Arc ;
77
88use pyo3:: prelude:: * ;
9+ use pyo3:: exceptions:: PyRuntimeError ;
910use pyo3_async_runtimes:: tokio:: future_into_py;
1011use tokio:: sync:: Mutex ;
1112
@@ -15,8 +16,6 @@ use vectorless_primitives::{
1516 SectionCardInfo , SectionSummaryInfo , SimilarResult , TocEntry , TopicEntryInfo , WordCount ,
1617} ;
1718
18- use super :: error:: VectorlessError ;
19-
2019// =========================================================================
2120// PyDocumentInfo (existing — returned by compile)
2221// =========================================================================
@@ -126,7 +125,7 @@ fn id_to_str(id: u64) -> String {
126125}
127126
128127fn to_py_err ( e : impl std:: fmt:: Display ) -> PyErr {
129- PyErr :: from ( VectorlessError :: new ( e. to_string ( ) , "navigation" ) )
128+ PyRuntimeError :: new_err ( e. to_string ( ) )
130129}
131130
132131#[ pymethods]
@@ -382,10 +381,10 @@ impl PyDocument {
382381 let num = node_id
383382 . strip_prefix ( 'n' )
384383 . ok_or_else ( || {
385- VectorlessError :: new ( "NodeId must start with 'n'" . to_string ( ) , "navigation ")
384+ PyRuntimeError :: new_err ( "NodeId must start with 'n'" )
386385 } ) ?
387386 . parse :: < u64 > ( )
388- . map_err ( |_| VectorlessError :: new ( "Invalid NodeId" . to_string ( ) , "navigation ") ) ?;
387+ . map_err ( |_| PyRuntimeError :: new_err ( "Invalid NodeId" ) ) ?;
389388 let nav = nav. lock ( ) . await ;
390389 Ok ( nav
391390 . chains_for ( num)
@@ -403,10 +402,10 @@ impl PyDocument {
403402 let num = node_id
404403 . strip_prefix ( 'n' )
405404 . ok_or_else ( || {
406- VectorlessError :: new ( "NodeId must start with 'n'" . to_string ( ) , "navigation ")
405+ PyRuntimeError :: new_err ( "NodeId must start with 'n'" )
407406 } ) ?
408407 . parse :: < u64 > ( )
409- . map_err ( |_| VectorlessError :: new ( "Invalid NodeId" . to_string ( ) , "navigation ") ) ?;
408+ . map_err ( |_| PyRuntimeError :: new_err ( "Invalid NodeId" ) ) ?;
410409 let nav = nav. lock ( ) . await ;
411410 Ok ( nav
412411 . overlaps_for ( num)
@@ -424,10 +423,10 @@ impl PyDocument {
424423 let num = node_id
425424 . strip_prefix ( 'n' )
426425 . ok_or_else ( || {
427- VectorlessError :: new ( "NodeId must start with 'n'" . to_string ( ) , "navigation ")
426+ PyRuntimeError :: new_err ( "NodeId must start with 'n'" )
428427 } ) ?
429428 . parse :: < u64 > ( )
430- . map_err ( |_| VectorlessError :: new ( "Invalid NodeId" . to_string ( ) , "navigation ") ) ?;
429+ . map_err ( |_| PyRuntimeError :: new_err ( "Invalid NodeId" ) ) ?;
431430 let nav = nav. lock ( ) . await ;
432431 Ok ( nav. evidence_score_for ( num) . await . map ( PyEvidenceScore :: from) )
433432 } )
0 commit comments