Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion crates/cli/src/output/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ fn infer_error_metadata(message: &str) -> (&'static str, bool, Option<String>) {
return ("conflict", false, Some(CONFLICT_SUGGESTION.to_string()));
}

if normalized.contains("does not support") || normalized.contains("unsupported") {
if normalized.contains("does not support")
|| normalized.contains("unsupported")
|| normalized.contains("not yet supported")
{
return (
"unsupported_feature",
false,
Expand Down Expand Up @@ -509,6 +512,30 @@ mod tests {
assert_eq!(details.suggestion.as_deref(), Some(USAGE_SUGGESTION));
}

#[test]
fn test_error_descriptor_from_message_infers_conflict() {
let descriptor = ErrorDescriptor::from_message("Destination exists: report.json");
let json = descriptor.to_json_output();

let details = json.details.expect("details should be present");
assert_eq!(details.error_type, "conflict");
assert!(!details.retryable);
assert_eq!(details.suggestion.as_deref(), Some(CONFLICT_SUGGESTION));
}

#[test]
fn test_error_descriptor_from_message_infers_unsupported_feature() {
let descriptor = ErrorDescriptor::from_message(
"Cross-alias S3-to-S3 copy not yet supported. Use download + upload.",
);
let json = descriptor.to_json_output();

let details = json.details.expect("details should be present");
assert_eq!(details.error_type, "unsupported_feature");
assert!(!details.retryable);
assert_eq!(details.suggestion.as_deref(), Some(UNSUPPORTED_SUGGESTION));
}

#[test]
fn test_error_with_suggestion_overrides_default_hint() {
let descriptor = ErrorDescriptor::from_code(
Expand Down