Skip to content

Commit

Permalink
Make error & warning messages more specific
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabycollins committed Sep 3, 2020
1 parent 976dd59 commit 75c77dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Updater.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// REWIND GAMING BROADCAST OVERLAY UPDATER
// VERSION 1.0
// VERSION 1.1
// LICENSED UNDER GPL-3.0

// FOR DOCUMENTATION AND LICENSING INFORMATION PLEASE SEE:
Expand Down Expand Up @@ -81,7 +81,7 @@ class GraphicsUpdater {
cellValue = parseInt(cellValue);
}
catch (error) {
console.warn('Failed to parse counter number from spreadsheet: make sure it\'s a number!');
console.warn(`Failed to parse counter number '${cellValue.toString()}' for ID(s) '${ids.toString}' from spreadsheet: make sure it's a number!\nReceived the following error:\n${error.toString()}`);
}
for (let i = 0; i < cellValue; i++) {
document.getElementById(ids[i]).style.display = '';
Expand Down Expand Up @@ -119,12 +119,12 @@ class GraphicsUpdater {
try {
let response = await fetch(this.url);
if (!response.ok) {
throw 'Failed to find your spreadsheet!';
throw 'Failed to find your spreadsheet! Make sure it\'s public and the given ID is correct.';
}
cells = await response.json();
}
catch (error) {
throw 'Failed to access spreadsheet on Google Sheets API';
throw 'Failed to access spreadsheet on Google Sheets API! Make sure your API key is correct, and enabled on the Google Sheets API.';
}
cells = cells.values;

Expand Down Expand Up @@ -171,8 +171,8 @@ class GraphicsUpdater {
try {
run(this.arrayMap[type][locationString], cellValue);
}
catch {
console.warn(`Failed to update ${this.arrayMap[type][locationString]}!`);
catch (error) {
console.warn(`Failed to update ${this.arrayMap[type][locationString].toString()} with value ${cellValue.toString()}!\nReceived the following error:\n${error.toString()}`);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Updater.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75c77dd

Please sign in to comment.