Skip to content

Commit

Permalink
make translation server more defensive when payload empty (#5619)
Browse files Browse the repository at this point in the history
* make translation server more defensive when payload empty

* clean

* new error class instead

* clean

* add try/catch for 'GET'

* remove new HTTPError work, throw Error instead
  • Loading branch information
jackgrossman18 authored Apr 12, 2023
1 parent db07e70 commit 2fc1af2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions translations/TranslationServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ var getPresets = function(params) {

// This is where all interesting things happen interfacing with hoot core lib directly
var postHandler = function(data) {
if (data.osm === '')
throw new Error('Payload cannot be empty')
if (availableTranslations.indexOf(data.translation) === -1) {
throw new Error('Unsupported translation schema ' + data.translation);
}
Expand Down

0 comments on commit 2fc1af2

Please sign in to comment.