client: add error type field for --json outputs
Some checks failed
Some checks failed
This commit is contained in:
@@ -47,6 +47,7 @@ pub fn print_drop_databases_output_status_json(output: &DropDatabasesResponse) {
|
||||
name.to_string(),
|
||||
json!({
|
||||
"status": "error",
|
||||
"type": err.error_type(),
|
||||
"error": err.to_error_message(name),
|
||||
}),
|
||||
),
|
||||
@@ -76,4 +77,13 @@ impl DropDatabaseError {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn error_type(&self) -> &'static str {
|
||||
match self {
|
||||
DropDatabaseError::SanitizationError(_) => "sanitization-error",
|
||||
DropDatabaseError::OwnershipError(_) => "ownership-error",
|
||||
DropDatabaseError::DatabaseDoesNotExist => "database-does-not-exist",
|
||||
DropDatabaseError::MySqlError(_) => "mysql-error",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user