Mercurial > public > mercurial-scm > hg
diff rust/rhg/src/main.rs @ 49488:9f14126cfc4c
rust: add support for hints in error messages
This will be used by the narrow support code in the next commit.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Tue, 19 Jul 2022 17:07:09 +0200 |
parents | 85f5d11c77dd |
children | 44bc045a43ca |
line wrap: on
line diff
--- a/rust/rhg/src/main.rs Mon Jul 11 11:59:13 2022 +0200 +++ b/rust/rhg/src/main.rs Tue Jul 19 17:07:09 2022 +0200 @@ -372,8 +372,7 @@ match result { Ok(()) => exit_codes::OK, Err(CommandError::Abort { - message: _, - detailed_exit_code, + detailed_exit_code, .. }) => { if use_detailed_exit_code { *detailed_exit_code @@ -480,15 +479,15 @@ match &result { Ok(_) => {} Err(CommandError::Unsuccessful) => {} - Err(CommandError::Abort { - message, - detailed_exit_code: _, - }) => { + Err(CommandError::Abort { message, hint, .. }) => { + // Ignore errors when writing to stderr, we’re already exiting + // with failure code so there’s not much more we can do. if !message.is_empty() { - // Ignore errors when writing to stderr, we’re already exiting - // with failure code so there’s not much more we can do. let _ = ui.write_stderr(&format_bytes!(b"{}\n", message)); } + if let Some(hint) = hint { + let _ = ui.write_stderr(&format_bytes!(b"({})\n", hint)); + } } Err(CommandError::UnsupportedFeature { message }) => { match on_unsupported {