Returns a human-readable suggestion for how to fix this error. This is intended for CLI error reporting where a "did you mean?" style hint can guide the user.
(&self)
| 300 | /// This is intended for CLI error reporting where a "did you mean?" |
| 301 | /// style hint can guide the user. |
| 302 | pub fn suggestion(&self) -> Option<&'static str> { |
| 303 | match self { |
| 304 | FormatError::InvalidMagic { .. } => { |
| 305 | Some("This file may be a V1/V2 change file. Re-record with the current version.") |
| 306 | } |
| 307 | FormatError::UnsupportedVersion { .. } => { |
| 308 | Some("Update Atomic to a version that supports this format.") |
| 309 | } |
| 310 | FormatError::HashTableFull => { |
| 311 | Some("Split this change into smaller changes with fewer dependencies.") |
| 312 | } |
| 313 | FormatError::HashMismatch { .. } => { |
| 314 | Some("The change file may be corrupt. Try re-downloading or re-recording.") |
| 315 | } |
| 316 | FormatError::SectionTruncated { .. } | FormatError::UnexpectedEof { .. } => { |
| 317 | Some("The file appears truncated. Try re-downloading.") |
| 318 | } |
| 319 | _ => None, |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | #[cfg(test)] |
no outgoing calls