Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
blendb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
C3SL
blendb
Commits
e034df60
There was a problem fetching the pipeline summary.
Commit
e034df60
authored
7 years ago
by
Lucas Fernandes de Oliveira
Browse files
Options
Downloads
Plain Diff
Merge branch 'issue/28' into 'master'
Issue
#28
: Add error field in API error responses See merge request
!32
parents
a4f36ad1
1a2119a1
No related branches found
No related tags found
1 merge request
!32
Issue #28: Add error field in API error responses
Pipeline
#
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/controllers/data.spec.ts
+6
-0
6 additions, 0 deletions
src/api/controllers/data.spec.ts
src/api/controllers/data.ts
+10
-4
10 additions, 4 deletions
src/api/controllers/data.ts
with
16 additions
and
4 deletions
src/api/controllers/data.spec.ts
+
6
−
0
View file @
e034df60
...
...
@@ -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
);
});
...
...
This diff is collapsed.
Click to expand it.
src/api/controllers/data.ts
+
10
−
4
View file @
e034df60
...
...
@@ -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
;
}
...
...
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