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)
| 280 | /// This is intended for CLI error reporting where a "did you mean?" |
| 281 | /// style hint can guide the user. |
| 282 | pub fn suggestion(&self) -> Option<&'static str> { |
| 283 | match self { |
| 284 | FormatError::InvalidMagic { .. } => { |
| 285 | Some("This file may be a V1/V2 change file. Re-record with the current version.") |
| 286 | } |
| 287 | FormatError::UnsupportedVersion { .. } => { |
| 288 | Some("Update Atomic to a version that supports this format.") |
| 289 | } |
| 290 | FormatError::HashTableFull => { |
| 291 | Some("Split this change into smaller changes with fewer dependencies.") |
| 292 | } |
| 293 | FormatError::HashMismatch { .. } => { |
| 294 | Some("The change file may be corrupt. Try re-downloading or re-recording.") |
| 295 | } |
| 296 | FormatError::SectionTruncated { .. } | FormatError::UnexpectedEof { .. } => { |
| 297 | Some("The file appears truncated. Try re-downloading.") |
| 298 | } |
| 299 | _ => None, |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | #[cfg(test)] |
no outgoing calls