forked from MarseyWorld/MarseyWorld
twentyone: show ratelimit error when ratelimited
parent
89d5428f77
commit
0dd956ae0e
|
@ -11,6 +11,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleBlackjackResponse(xhr) {
|
function handleBlackjackResponse(xhr) {
|
||||||
|
let status;
|
||||||
try {
|
try {
|
||||||
const response = JSON.parse(xhr.response);
|
const response = JSON.parse(xhr.response);
|
||||||
const succeeded = xhr.status >= 200 &&
|
const succeeded = xhr.status >= 200 &&
|
||||||
|
@ -19,6 +20,11 @@
|
||||||
!response.error;
|
!response.error;
|
||||||
|
|
||||||
clearResult();
|
clearResult();
|
||||||
|
status = xhr.status;
|
||||||
|
|
||||||
|
if (status == 429) {
|
||||||
|
throw new Error(response["details"]);
|
||||||
|
}
|
||||||
|
|
||||||
if (succeeded) {
|
if (succeeded) {
|
||||||
updateBlackjackTable(response.state);
|
updateBlackjackTable(response.state);
|
||||||
|
@ -36,8 +42,13 @@
|
||||||
"double-down": "Unable to double down.",
|
"double-down": "Unable to double down.",
|
||||||
"buy-insurance": "Unable to buy insurance."
|
"buy-insurance": "Unable to buy insurance."
|
||||||
};
|
};
|
||||||
|
result = results[xhr.blackjackAction];
|
||||||
|
|
||||||
updateResult(results[xhr.blackjackAction], "danger");
|
if (status == 429) {
|
||||||
|
result = error.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateResult(result, "danger");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue