Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fordecyt_2019
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rodrigo Tapia-McClung
fordecyt_2019
Commits
b45bb4cf
Commit
b45bb4cf
authored
Aug 15, 2019
by
Anne Blankert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved error response
parent
8906cf67
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
layer_columns.js
layer_columns.js
+13
-8
No files found.
layer_columns.js
View file @
b45bb4cf
...
...
@@ -45,15 +45,20 @@ module.exports = function (app, pool) {
const
result
=
await
pool
.
query
(
sqlString
);
res
.
json
(
result
.
rows
);
}
catch
(
err
)
{
console
.
log
(
err
);
let
status
=
500
;
switch
(
err
.
code
)
{
case
'42P01'
:
err
.
name
=
`table
${
req
.
params
.
table
}
does not exist`
;
// table does not exist
status
=
422
;
break
;
case
'42703'
:
err
.
name
=
`column does not exist`
;
// column does not exist
status
=
422
;
break
;
default
:
}
res
.
status
(
422
).
json
({
error
:
err
});
res
.
status
(
status
).
json
({
error
:
err
.
message
})
}
})
}
\ No newline at end of file
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