Improved error handling

This commit is contained in:
2026-05-15 21:57:59 +02:00
parent c6b9588f4d
commit efe32d8e5f
2 changed files with 20 additions and 18 deletions
+5 -2
View File
@@ -119,12 +119,15 @@ where
pub struct AstErrorAnalyzer<'a, T>(pub Option<AstError<'a, T>>);
impl<'a, T> AstErrorAnalyzer<'a, T> {
pub fn get<V: Clone>(&mut self, r: AstResult<'a, V>) -> AstResult<'a, V> {
pub fn get<V: Clone, V2: Clone + Into<V>>(
&mut self,
r: AstResult<'a, V, V2>,
) -> AstResult<'a, V, V2> {
if let Err(e) = r {
self.0 = Some(e.clone().get());
if let Some(recovered) = e.recovered {
Ok(recovered)
Ok(recovered.into())
} else {
Err(e)
}