better gambling error messages

master
Aevann 2023-08-08 20:06:03 +03:00
parent 40045eaa35
commit 1ad2493eab
5 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ function handleBlackjackResponse(xhr) {
const succeeded = xhr.status >= 200 && const succeeded = xhr.status >= 200 &&
xhr.status < 300 && xhr.status < 300 &&
response && response &&
!response.error; !response.details;
clearResult(); clearResult();
status = xhr.status; status = xhr.status;
@ -28,7 +28,7 @@ function handleBlackjackResponse(xhr) {
updateFeed(response.feed); updateFeed(response.feed);
updatePlayerCurrencies(response.gambler); updatePlayerCurrencies(response.gambler);
} else { } else {
console.error("Error: ", response.error); console.error("Error: ", response.details);
throw new Error("Error") throw new Error("Error")
} }
} catch (error) { } catch (error) {

View File

@ -109,7 +109,7 @@ function handleFeedResponse(xhr) {
} }
const succeeded = const succeeded =
xhr.status >= 200 && xhr.status < 300 && response && !response.error; xhr.status >= 200 && xhr.status < 300 && response && !response.details;
if (succeeded) { if (succeeded) {
document.getElementById("casinoGameFeed").dataset.feed = JSON.stringify(response.feed); document.getElementById("casinoGameFeed").dataset.feed = JSON.stringify(response.feed);

View File

@ -364,7 +364,7 @@ function handleRouletteResponse(xhr) {
} }
const succeeded = const succeeded =
xhr.status >= 200 && xhr.status < 300 && response && !response.error; xhr.status >= 200 && xhr.status < 300 && response && !response.details;
if (succeeded) { if (succeeded) {
buildRouletteBets(response.bets); buildRouletteBets(response.bets);

View File

@ -30,7 +30,7 @@ function handleSlotsResponse(xhr) {
} }
const succeeded = const succeeded =
xhr.status >= 200 && xhr.status < 300 && response && !response.error; xhr.status >= 200 && xhr.status < 300 && response && !response.details;
if (succeeded) { if (succeeded) {
const { game_state, gambler } = response; const { game_state, gambler } = response;
@ -58,8 +58,8 @@ function handleSlotsResponse(xhr) {
updatePlayerCurrencies(gambler); updatePlayerCurrencies(gambler);
reloadFeed() reloadFeed()
} else { } else {
updateResult(response.error, "danger"); updateResult(response.details, "danger");
console.error(response.error); console.error(response.details);
} }
enableWager(); enableWager();

View File

@ -87,7 +87,7 @@ function handleLotteryResponse(xhr, method, callback) {
const toastMessage = document.getElementById("lottery-post-error-text"); const toastMessage = document.getElementById("lottery-post-error-text");
toastMessage.innerText = toastMessage.innerText =
(response && response.error) || "Error, please try again later."; (response && response.details) || "Error, please try again later.";
bootstrap.Toast.getOrCreateInstance(toast).show(); bootstrap.Toast.getOrCreateInstance(toast).show();
} }