File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -472,14 +472,24 @@ export default class UploadPlugin extends AdminForthPlugin {
472472 server . endpoint ( {
473473 method : 'POST' ,
474474 path : `/plugin/${ this . pluginInstanceId } /get-image-generation-job-status` ,
475- handler : async ( { body, adminUser, headers } ) => {
475+ handler : async ( { body, adminUser, headers, response } ) => {
476476 const jobId = body . jobId ;
477477 if ( ! jobId ) {
478- return { error : "Can't find job id" } ;
478+ response . setStatus ( 400 ) ;
479+ return { ok : false , error : "Can't find job id" } ;
479480 }
480481 const job = jobs . get ( jobId ) ;
481482 if ( ! job ) {
482- return { error : "Job not found" } ;
483+ response . setStatus ( 404 ) ;
484+ return { ok : false , error : "Job not found" } ;
485+ }
486+ if ( job . status === 'failed' || job . error ) {
487+ response . setStatus ( 500 ) ;
488+
489+ return {
490+ ok : false ,
491+ job,
492+ } ;
483493 }
484494 return { ok : true , job } ;
485495 }
You can’t perform that action at this time.
0 commit comments