Skip to content
Snippets Groups Projects
Commit fe87f4e9 authored by sivan's avatar sivan
Browse files

don't crash on errors

parent fe9410eb
No related branches found
No related tags found
No related merge requests found
......@@ -40,8 +40,10 @@ func onMessageReceived(msg amqp.Delivery) {
// Convert the json byte msg to an aql query string
//aqlQuery, err := aql.ConvertJSONToAQL(&msg.Body)
errorhandler.FailWithError(err, "failed to parse incoming msg to AQL") // TODO: don't panic on error, send error message to client instead
if err != nil {
errorhandler.LogError(err, "failed to parse incoming msg to AQL") // TODO: don't panic on error, send error message to client instead
return
}
fmt.Println("Query: " + *aqlQuery)
// Get the queueID for this sessionID
......
......@@ -29,6 +29,7 @@ func SendAQLQuery(AQLQuery string) (*[]byte, error) {
})
if err != nil {
log.Println("could not connect to database") // Handle error
return nil, err
}
c, err := driver.NewClient(driver.ClientConfig{
Connection: conn,
......@@ -36,6 +37,7 @@ func SendAQLQuery(AQLQuery string) (*[]byte, error) {
})
if err != nil {
log.Println("Could not log in to the ArangoDB") // Handle error
return nil, err
}
ctx := context.Background()
......@@ -43,6 +45,7 @@ func SendAQLQuery(AQLQuery string) (*[]byte, error) {
if err != nil {
// handle error
log.Println(err)
return nil, err
}
//fmt.Println(AQLQuery)
......@@ -68,6 +71,7 @@ func SendAQLQuery(AQLQuery string) (*[]byte, error) {
break
} else if err != nil {
// handle other errors
return nil, err
}
//fmt.Printf("%T\n", doc)
queryResult = append(queryResult, formatToJSON(doc))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment