Skip to content

Commit 1e18737

Browse files
committed
Reduce redundant console logging code
1 parent a2a37f5 commit 1e18737

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/chestManagement/chestManagement.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ function refreshClick(){
9191

9292
async function refreshInventory(userId: string, hash: string) {
9393
if(!userId || userId.length == 0 || !hash || hash.length == 0){
94-
console.error("No credentials entered.")
9594
showError("No credentials entered.")
9695
return
9796
}
@@ -103,7 +102,6 @@ async function refreshInventory(userId: string, hash: string) {
103102

104103
if(!_server) {
105104
showError("Failed to get idle champions server.")
106-
console.error("Failed to get idle champions server.")
107105
return
108106
}
109107

@@ -115,7 +113,6 @@ async function refreshInventory(userId: string, hash: string) {
115113

116114
if(!_userData) {
117115
showError("Failed to retreive user data.")
118-
console.error("Failed to retreive user data.")
119116
return
120117
}
121118

@@ -243,12 +240,10 @@ async function purchaseChests(userId: string, hash: string){
243240
console.log("Switching server")
244241
}
245242
if(responseStatus.status == ResponseStatus.InsuficcientCurrency){
246-
console.error("Insufficient currency error")
247243
showError("Insufficient gems remaining")
248244
return
249245
}
250246
else if(responseStatus.status == ResponseStatus.Failed){
251-
console.error("Purchase API call failed")
252247
showError("Purchase failed")
253248
return
254249
}
@@ -337,15 +332,13 @@ async function openChests(userId: string, hash: string){
337332
console.log("Refreshing inventory for instance ID")
338333
await refreshInventory(userId, hash)
339334
if(_instanceId == lastInstanceId){
340-
console.error("Failed to refresh instance id")
341335
showError("Failed to get updated instance ID. Check credentials.")
342336
return
343337
}
344338

345339
remainingChests += currentAmount
346340
}
347341
else if(openResponse.status == ResponseStatus.Failed){
348-
console.error("Purchase API call failed")
349342
showError("Purchase failed")
350343
return
351344
}
@@ -377,6 +370,8 @@ function hideMessages() {
377370
}
378371

379372
function showError(text:string){
373+
console.error(text)
374+
380375
hideMessages()
381376

382377
document.getElementById("error")!.classList.add("show")
@@ -538,15 +533,13 @@ async function useBlacksmithContracts(userId: string, hash: string){
538533
console.log("Refreshing inventory for instance ID")
539534
await refreshInventory(userId, hash)
540535
if(_instanceId == lastInstanceId){
541-
console.error("Failed to refresh instance id")
542536
showError("Failed to get updated instance ID. Check credentials.")
543537
return
544538
}
545539

546540
remainingContracts += currentAmount
547541
}
548542
else if(blacksmithResponse.status == ResponseStatus.Failed){
549-
console.error("Blacksmith API call failed")
550543
showError("Blacksmithing failed")
551544
return
552545
}

0 commit comments

Comments
 (0)