Skip to content

Commit

Permalink
send 504 when REACH times out
Browse files Browse the repository at this point in the history
  • Loading branch information
d2fong committed Mar 13, 2018
1 parent ff85099 commit d9371b1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/server/routes/api/document/index.js
Expand Up @@ -80,8 +80,13 @@ http.post('/', function( req, res ){
.then( getDocJson )
.then( json => res.json( json ) )
.catch( e => {
logger.error('Could not fill doc from text: ', `text: ${text}`, e);
res.sendStatus(500);

if( e instanceof Promise.TimeoutError ){
res.sendStatus(504);
} else {
logger.error('Could not fill doc from text: ', `text: ${text}`, e);
res.sendStatus(500);
}
throw e;
} )
);
Expand Down

0 comments on commit d9371b1

Please sign in to comment.