Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
query-service
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
Microservices
query-service
Commits
fe87f4e9
Commit
fe87f4e9
authored
3 years ago
by
sivan
Browse files
Options
Downloads
Patches
Plain Diff
don't crash on errors
parent
fe9410eb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/query-service/main.go
+4
-2
4 additions, 2 deletions
cmd/query-service/main.go
internal/request/request.go
+4
-0
4 additions, 0 deletions
internal/request/request.go
with
8 additions
and
2 deletions
cmd/query-service/main.go
+
4
−
2
View file @
fe87f4e9
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
internal/request/request.go
+
4
−
0
View file @
fe87f4e9
...
...
@@ -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
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment