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
8906cf67
Commit
8906cf67
authored
Aug 15, 2019
by
Anne Blankert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved error response
parent
14e30206
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
geobuf.js
geobuf.js
+13
-9
geojson.js
geojson.js
+7
-3
No files found.
geobuf.js
View file @
8906cf67
...
@@ -103,15 +103,19 @@ const sql = (params, query) => {
...
@@ -103,15 +103,19 @@ const sql = (params, query) => {
res
.
set
(
'Content-Type'
,
'text/x-protobuf'
).
send
(
result
.
rows
[
0
].
st_asgeobuf
);
res
.
set
(
'Content-Type'
,
'text/x-protobuf'
).
send
(
result
.
rows
[
0
].
st_asgeobuf
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
err
);
console
.
log
(
err
);
switch
(
err
.
code
)
{
let
status
=
500
;
case
'42P01'
:
switch
(
err
.
code
)
{
err
.
name
=
`table
${
req
.
params
.
table
}
does not exist`
;
case
'42P01'
:
break
;
// table does not exist
case
'42703'
:
status
=
422
;
err
.
name
=
`column does not exist`
;
break
;
break
;
case
'42703'
:
}
// column does not exist
res
.
status
(
422
).
json
({
error
:
err
})
status
=
422
;
break
;
default
:
}
res
.
status
(
status
).
json
({
error
:
err
.
message
})
}
}
})
})
}
}
\ No newline at end of file
geojson.js
View file @
8906cf67
...
@@ -103,15 +103,19 @@ module.exports = function(app, pool) {
...
@@ -103,15 +103,19 @@ module.exports = function(app, pool) {
res
.
json
(
result
.
rows
[
0
].
geojson
)
res
.
json
(
result
.
rows
[
0
].
geojson
)
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
err
);
console
.
log
(
err
);
let
status
=
500
;
switch
(
err
.
code
)
{
switch
(
err
.
code
)
{
case
'42P01'
:
case
'42P01'
:
err
.
name
=
`table
${
req
.
params
.
table
}
does not exist`
;
// table does not exist
status
=
422
;
break
;
break
;
case
'42703'
:
case
'42703'
:
err
.
name
=
`column does not exist`
;
// column does not exist
status
=
422
;
break
;
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