File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,22 @@ func (r ResultsPredicatesHTTPWrapper) PredicateSeverityAndState(predicate *Predi
102102 _ = resp .Body .Close ()
103103 }()
104104
105+ // in case of ne/pne when mandatory comment arent provided, cli is not transforming error message
106+ responseMap := make (map [string ]interface {})
107+ if err := json .NewDecoder (resp .Body ).Decode (& responseMap ); err != nil {
108+ logger .PrintIfVerbose (fmt .Sprintf ("failed to read the response, %v" , err .Error ()))
109+ } else {
110+ if val , ok := responseMap ["code" ].(float64 ); ok {
111+ if val == 4002 && responseMap ["message" ] != nil {
112+ if errMsg , ok := responseMap ["message" ].(string ); ok {
113+ if errMsg == "A comment is required to make changes to the result state" {
114+ return nil , errors .Errorf (errMsg )
115+ }
116+ }
117+ }
118+ }
119+ }
120+
105121 switch resp .StatusCode {
106122 case http .StatusBadRequest , http .StatusInternalServerError :
107123 return nil , errors .Errorf ("Predicate bad request." )
You can’t perform that action at this time.
0 commit comments