File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,20 +30,17 @@ impl ResponseError for AppError {
3030 fn error_response ( & self ) -> HttpResponse {
3131 log_error ! ( TAG , "AppError occurred: {:?}" , self ) ;
3232
33- // Check if this is a "not ready" error and return 503 instead of 500
33+ // Keep legacy error body shape for bindings clients that parse a plain string.
34+ // We still use 503 for readiness-related failures so callers can retry.
3435 let error_msg = self . 0 . to_string ( ) ;
36+ let legacy_body = format ! ( "Something went wrong: {error_msg}" ) ;
3537 if error_msg. contains ( "Backend not ready" )
3638 || error_msg. contains ( "not initialized" )
3739 || error_msg. contains ( "Initialization" ) {
38- return HttpResponse :: ServiceUnavailable ( )
39- . json ( serde_json:: json!( {
40- "error" : "Service temporarily unavailable" ,
41- "message" : error_msg,
42- "retry_after" : 5
43- } ) ) ;
40+ return HttpResponse :: ServiceUnavailable ( ) . json ( legacy_body) ;
4441 }
4542
46- HttpResponse :: InternalServerError ( ) . json ( format ! ( "Something went wrong: {error_msg}" ) )
43+ HttpResponse :: InternalServerError ( ) . json ( legacy_body )
4744 }
4845}
4946
You can’t perform that action at this time.
0 commit comments