Skip to content

Commit

Permalink
Switched from AbortWithError to String, as gin doesn't output the err…
Browse files Browse the repository at this point in the history
…or when calling the abort function
  • Loading branch information
lkarlslund committed Feb 14, 2024
1 parent 1cea88e commit 7bdd945
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions modules/analyze/webservicefuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package analyze

import (
"encoding/json"
"errors"
"fmt"
"slices"
"sort"
Expand Down Expand Up @@ -238,22 +237,22 @@ func analysisfuncs(ws *webservice) {

opts.StartFilter, err = query.ParseLDAPQueryStrict(startquerytext, ws.Objs)
if err != nil {
c.AbortWithError(500, fmt.Errorf("Error parsing start query: %v", err))
c.String(500, "Error parsing start query: %v", err)
return
}

if middlequerytext != "" {
opts.MiddleFilter, err = query.ParseLDAPQueryStrict(middlequerytext, ws.Objs)
if err != nil {
c.AbortWithError(500, fmt.Errorf("Error parsing middle query: %v", err))
c.String(500, "Error parsing middle query: %v", err)
return
}
}

if endquerytext != "" {
opts.EndFilter, err = query.ParseLDAPQueryStrict(endquerytext, ws.Objs)
if err != nil {
c.AbortWithError(500, fmt.Errorf("Error parsing end query: %v", err))
c.String(500, "Error parsing end query: %v", err)
return
}
}
Expand Down Expand Up @@ -350,7 +349,7 @@ func analysisfuncs(ws *webservice) {

cytograph, err := GenerateCytoscapeJS(results.Graph, alldetails)
if err != nil {
c.AbortWithError(500, fmt.Errorf("Error generating cytoscape graph: %v", err))
c.String(500, "Error generating cytoscape graph: %v", err)
return
}

Expand Down Expand Up @@ -705,14 +704,14 @@ func analysisfuncs(ws *webservice) {
} else {
id, err := strconv.Atoi(idstr)
if err != nil {
c.AbortWithError(400, err)
c.String(400, "Problem converting id %v: %v", idstr, err)
return
}

if parent, found := ws.Objs.FindID(engine.ObjectID(id)); found {
children = parent.Children()
} else {
c.AbortWithError(404, errors.New("object not found"))
c.String(404, "object not found")
return
}
}
Expand Down

0 comments on commit 7bdd945

Please sign in to comment.