MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / format_parse_error

Function format_parse_error

crates/hyperqueue/src/common/parser.rs:190–199  ·  view source on GitHub ↗
(error: nom::Err<ParserError<&str>>, input: &str)

Source from the content-addressed store, hash-verified

188}
189
190pub fn format_parse_error(error: nom::Err<ParserError<&str>>, input: &str) -> anyhow::Error {
191 match error {
192 nom::Err::Error(e) | nom::Err::Failure(e) => {
193 let mut buffer = "Parse error\n".to_string();
194 format_error(e.0, 0, input, &mut buffer);
195 anyhow::anyhow!("{}", buffer.trim_end())
196 }
197 nom::Err::Incomplete(needed) => anyhow::anyhow!("Incomplete input (needed: {:?})", needed),
198 }
199}
200
201pub type NomResult<'a, Ret> = IResult<&'a str, Ret, ParserError<&'a str>>;
202

Callers 1

map_parse_resultFunction · 0.85

Calls 2

format_errorFunction · 0.85
to_stringMethod · 0.80

Tested by

no test coverage detected