Skip to content

Commit 8534cfa

Browse files
committed
refactor: removeBalance and getUserBalance - Log errors instead of throwing
1 parent 26f8408 commit 8534cfa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/commands/public/resource/store.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ async function removeBalance(userId, amount) {
66
try {
77
const userProfile = await UserProfile.findOne({ userId });
88
if (!userProfile) {
9-
throw new Error("User profile not found.");
9+
console.error("User profile not found.");
1010
}
1111

1212
userProfile.balance -= amount;
@@ -23,7 +23,7 @@ async function getUserBalance(userId) {
2323
try {
2424
const userProfile = await UserProfile.findOne({ userId });
2525
if (!userProfile) {
26-
throw new Error("User profile not found.");
26+
console.error("User profile not found.");
2727
}
2828

2929
return userProfile.balance;
@@ -88,5 +88,5 @@ module.exports = {
8888
);
8989
}
9090
}
91-
},
91+
}
9292
};

0 commit comments

Comments
 (0)