Skip to content

Commit ce15be9

Browse files
Merge branch 'feature/add-new-sscs-licensing' of https://github.com/Checkmarx/ast-cli into feature/add-new-sscs-licensing
2 parents 8672dd3 + 0fa924f commit ce15be9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

internal/wrappers/predicates-http.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff 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.")

0 commit comments

Comments
 (0)