Unify some more error handling.
This commit is contained in:
@@ -134,7 +134,7 @@ fn document_org_source<'b, 'g, 'r, 's>(
|
||||
}
|
||||
final_settings.extend(document_settings);
|
||||
let new_settings = apply_in_buffer_settings(final_settings, context.get_global_settings())
|
||||
.map_err(|err| nom::Err::Error(CustomError::from(err)))?;
|
||||
.map_err(nom::Err::Error)?;
|
||||
let new_context = context.with_global_settings(&new_settings);
|
||||
let context = &new_context;
|
||||
|
||||
@@ -159,15 +159,13 @@ fn document_org_source<'b, 'g, 'r, 's>(
|
||||
let parser_context = context.with_global_settings(&new_global_settings);
|
||||
let (remaining, mut document) = _document(&parser_context, input)
|
||||
.map(|(rem, out)| (Into::<&str>::into(rem), out))?;
|
||||
apply_post_parse_in_buffer_settings(&mut document)
|
||||
.map_err(|err| nom::Err::<CustomError>::Failure(err.into()))?;
|
||||
apply_post_parse_in_buffer_settings(&mut document);
|
||||
return Ok((remaining.into(), document));
|
||||
}
|
||||
}
|
||||
|
||||
// Find final in-buffer settings that do not impact parsing
|
||||
apply_post_parse_in_buffer_settings(&mut document)
|
||||
.map_err(|err| nom::Err::<CustomError>::Failure(err.into()))?;
|
||||
apply_post_parse_in_buffer_settings(&mut document);
|
||||
|
||||
Ok((remaining.into(), document))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user