Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
blendb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
C3SL
blendb
Commits
1a2119a1
Commit
1a2119a1
authored
Aug 25, 2017
by
Lucas Fernandes de Oliveira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#28
: Add error field in API error responses
Signed-off-by:
Lucas Fernandes de Oliveira
<
lfo14@inf.ufpr.br
>
parent
a4f36ad1
Pipeline
#11731
passed with stage
in 1 minute and 1 second
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
src/api/controllers/data.spec.ts
src/api/controllers/data.spec.ts
+6
-0
src/api/controllers/data.ts
src/api/controllers/data.ts
+10
-4
No files found.
src/api/controllers/data.spec.ts
View file @
1a2119a1
...
...
@@ -52,9 +52,12 @@ describe("API data controller", () => {
.
expect
((
res
:
any
)
=>
{
const
message
=
"
Query execution failed:
"
+
"
Could not construct query with the paramters given.
"
;
const
error
=
"
The metric named met:-1 was not found
"
;
expect
(
res
.
body
).
to
.
be
.
an
(
"
object
"
);
expect
(
res
.
body
).
to
.
have
.
property
(
"
message
"
);
expect
(
res
.
body
).
to
.
have
.
property
(
"
error
"
);
expect
(
res
.
body
.
message
).
to
.
be
.
eql
(
message
);
expect
(
res
.
body
.
error
).
to
.
be
.
eql
(
error
);
})
.
end
(
done
);
});
...
...
@@ -67,9 +70,12 @@ describe("API data controller", () => {
.
expect
((
res
:
any
)
=>
{
const
message
=
"
Query execution failed:
"
+
"
Could not construct query with the paramters given.
"
;
const
error
=
"
The dimension named dim:11 was not found
"
;
expect
(
res
.
body
).
to
.
be
.
an
(
"
object
"
);
expect
(
res
.
body
).
to
.
have
.
property
(
"
message
"
);
expect
(
res
.
body
).
to
.
have
.
property
(
"
error
"
);
expect
(
res
.
body
.
message
).
to
.
be
.
eql
(
message
);
expect
(
res
.
body
.
error
).
to
.
be
.
eql
(
error
);
})
.
end
(
done
);
});
...
...
src/api/controllers/data.ts
View file @
1a2119a1
...
...
@@ -48,15 +48,21 @@ export class DataCtrl {
view
=
req
.
engine
.
query
(
query
);
}
catch
(
e
)
{
res
.
status
(
500
).
json
({
message
:
"
Query execution failed:
"
+
"
Could not construct query with the paramters given.
"
});
res
.
status
(
500
).
json
({
message
:
"
Query execution failed:
"
+
"
Could not construct query with the paramters given.
"
,
error
:
e
.
message
});
return
;
}
req
.
adapter
.
getDataFromView
(
view
,
(
err
:
Error
,
result
:
any
[])
=>
{
if
(
err
)
{
res
.
status
(
500
).
json
({
message
:
"
Query execution failed
"
+
"
failed on execute query on database.
"
});
res
.
status
(
500
).
json
({
message
:
"
Query execution failed
"
+
"
failed on execute query on database.
"
,
error
:
err
});
return
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment