File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package process_queue
22
33import (
44 b64 "encoding/base64"
5+ "encoding/json"
56 "strings"
67
78 "github.com/google/uuid"
@@ -95,8 +96,27 @@ func (c CreateReport) Process() error {
9596 return err
9697 }
9798
99+ type limanResponse struct {
100+ Message string `json:"message"`
101+ Status int `json:"status"`
102+ }
103+
104+ var response limanResponse
98105 output := linux .Execute (command )
99106
100- c .Queue .UpdateAsDone (strings .TrimSpace (strings .ReplaceAll (output , "\" " , "" )))
107+ if err := json .Unmarshal ([]byte (output ), & response ); err != nil {
108+ // Update job as failed
109+ c .Queue .UpdateError (err .Error ())
110+ return err
111+ }
112+
113+ if response .Status != 200 {
114+ // Update job as failed
115+ c .Queue .UpdateError (response .Message )
116+ } else {
117+ // Update job as done
118+ c .Queue .UpdateAsDone (strings .TrimSpace (strings .ReplaceAll (output , "\" " , "" )))
119+ }
120+
101121 return nil
102122}
You can’t perform that action at this time.
0 commit comments