Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Merge pull request #48 from andrenatal/handling-kaldi-errors
Browse files Browse the repository at this point in the history
Handle kaldi errors
  • Loading branch information
andrenatal committed Jul 28, 2017
2 parents faecd3f + 02136bb commit 2c59695
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,15 @@ app.post('*', function (req, res, next) {
}

const resBody = asrBody && asrBody.toString('utf8');
res.json(JSON.parse(resBody));
try {
res.json(JSON.parse(resBody));
} catch (e) {
mozlog.info('request.asr.error', {
request_id: res.locals.request_id,
time: Date.now() - asr_request_start
});
return res.status(500).json({error: 'Internal STT Server Error'});
}

mozlog.info('request.asr.finish', {
request_id: res.locals.request_id,
Expand Down

0 comments on commit 2c59695

Please sign in to comment.