pub fn parse_ref_or_exit(input: &str) -> Result<Ref>Expand description
Parse a ref, or render the failure in the docs/ERRORS.md §3
“Researcher (CLI human)” form and return the CLI exit error.
#477. error[CODE]: message held on fetch alone – #119 did it there
and nowhere else – while info, link, cite, text, tag, bib,
csl and source each wrote their own with_context("invalid ref: …")
and let anyhow print a bare Error: plus a Caused by: chain. The
closed error-code set is a load-bearing promise of this project: a
caller is told it can key off error[CODE]:, and on eight of nine
commands there was no code to key off, while the Caused by: chain
leaked internal error types that are in no contract.
Same shape as render_fetch_error and for the same reason – one
renderer, so a future change to the contract cannot reach some call
sites and miss others.
§Errors
Always, when parsing fails: an anyhow::Error wrapping
CliExit with the INVALID_REF exit code. The
message has already been written to stderr.