Skip to content

Commit

Permalink
feat: Manage module's relogAccount() function now throws an error if …
Browse files Browse the repository at this point in the history
…an account does not exist to communicate failure. Implementer must catch this error
  • Loading branch information
3urobeat committed Feb 1, 2025
1 parent 92ce349 commit 4a146ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/controller/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2024-12-28 12:56:44
* Author: 3urobeat
*
* Last Modified: 2025-01-17 18:18:19
* Last Modified: 2025-01-31 17:57:54
* Modified By: 3urobeat
*
* Copyright (c) 2024 - 2025 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -60,7 +60,7 @@ Controller.prototype.removeAccount = function(accountName) {

// Abort if this account does not exist
if (!this.bots[accountName]) {
logger("warn", `Cannot remove account '${accountName}' because no bot instance exists for it!`);
logger("warn", `Cannot remove account '${accountName}' because no bot instance exists for it!`); // No need to throw an error, the account is already removed
return;
}

Expand Down Expand Up @@ -88,8 +88,7 @@ Controller.prototype.relogAccount = function(accountName) {

// Abort if this account does not exist
if (!this.bots[accountName]) {
logger("error", `Cannot relog account '${accountName}' because no bot instance exists for it!`);
return;
return new Error(`Cannot relog account '${accountName}' because no bot instance exists for it!`); // Communicate error back to caller
}

// Make sure this account is not included in skippedaccounts
Expand Down
2 changes: 1 addition & 1 deletion src/data/fileStructure.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
{
"path": "src/controller/manage.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/controller/manage.js",
"checksum": "9223071826776442308d58d1255e98eb"
"checksum": "cd1ac6e6f53927cc3f60a2d951824491"
},
{
"path": "src/data/ascii.js",
Expand Down

0 comments on commit 4a146ac

Please sign in to comment.