@@ -147,7 +147,7 @@ pub async fn wait_for_task(
147147 }
148148
149149 // Check if task failed
150- if state == "failed" || state == "error" {
150+ if state == "failed" || state == "error" || state == "processing-error" {
151151 return Err ( RedisCtlError :: InvalidInput {
152152 message : format ! ( "Task {} failed" , task_id) ,
153153 } ) ;
@@ -195,15 +195,22 @@ fn get_task_state(task: &Value) -> String {
195195fn is_terminal_state ( state : & str ) -> bool {
196196 matches ! (
197197 state. to_lowercase( ) . as_str( ) ,
198- "completed" | "complete" | "succeeded" | "success" | "failed" | "error" | "cancelled"
198+ "completed"
199+ | "complete"
200+ | "succeeded"
201+ | "success"
202+ | "failed"
203+ | "error"
204+ | "cancelled"
205+ | "processing-error"
199206 )
200207}
201208
202209/// Format task state for display
203210fn format_task_state ( state : & str ) -> String {
204211 match state. to_lowercase ( ) . as_str ( ) {
205212 "completed" | "complete" | "succeeded" | "success" => format ! ( "✓ {}" , state) ,
206- "failed" | "error" => format ! ( "✗ {}" , state) ,
213+ "failed" | "error" | "processing-error" => format ! ( "✗ {}" , state) ,
207214 "cancelled" => format ! ( "⊘ {}" , state) ,
208215 "processing" | "running" | "in_progress" => format ! ( "⟳ {}" , state) ,
209216 _ => state. to_string ( ) ,
@@ -239,8 +246,26 @@ fn print_task_details(task: &Value) -> CliResult<()> {
239246 println ! ( "Updated: {}" , updated) ;
240247 }
241248
249+ // Handle error details - check both top-level and nested in response
242250 if let Some ( error) = task. get ( "error" ) . or_else ( || task. get ( "errorMessage" ) ) {
243251 println ! ( "Error: {}" , error) ;
252+ } else if let Some ( response) = task. get ( "response" )
253+ && let Some ( error) = response. get ( "error" )
254+ {
255+ // Handle nested error object
256+ if let Some ( error_type) = error. get ( "type" ) {
257+ println ! ( "Error Type: {}" , error_type) ;
258+ }
259+ if let Some ( error_status) = error. get ( "status" ) {
260+ println ! ( "Error Status: {}" , error_status) ;
261+ }
262+ if let Some ( error_description) = error. get ( "description" ) {
263+ println ! ( "Error Description: {}" , error_description) ;
264+ }
265+ // If error is a simple string
266+ if error. is_string ( ) {
267+ println ! ( "Error: {}" , error) ;
268+ }
244269 }
245270
246271 Ok ( ( ) )
0 commit comments