Skip to content

Commit

Permalink
update 429 error message
Browse files Browse the repository at this point in the history
  • Loading branch information
JAMES ZHANG committed Mar 9, 2016
1 parent 8885c21 commit 3f9df44
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion public/js/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,15 @@ function allReady(thresholds, sampleText) {
* @param {Object} error
*/
function _error(error) {
console.log(error.responseJSON.code);
var message = typeof error.responseJSON.error === 'string' ?
error.responseJSON.error :
'Error code ' + error.responseJSON.error.code + ': ' + error.responseJSON.error.message;
$errorMessage.text(message);

if (error.responseJSON.code === 429)
message = 'You\'ve sent a lot of requests in a short amount of time. ' +
'As the CPU cores cool off a bit, wait a few seonds before sending more requests.'
$errorMessage.html(message);
$input.show();
$loading.hide();
$output.hide();
Expand Down

0 comments on commit 3f9df44

Please sign in to comment.