Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
chore: change to throw Error
Browse files Browse the repository at this point in the history
  • Loading branch information
louis70109 committed Apr 1, 2020
1 parent 2b24a25 commit 60cdbcd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/controller/notifiesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var NotifyController = /** @class */ (function () {
if (!isAlive) {
$notify.save(function (err) {
if (err)
throw err;
throw Error("Notify \u5132\u5B58\u5931\u6557\uFF1A " + err);
});
}
else {
Expand All @@ -49,7 +49,7 @@ var NotifyController = /** @class */ (function () {
};
notify_1.NotifyModel.findOneAndUpdate({ userId: userId }, userObj, function (err, _) {
if (err)
console.log(err);
throw Error("Notify \u66F4\u65B0\u5931\u6557: " + err);
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion dist/controller/users/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function userBinding(context, _a) {
user.save(function (err) {
if (err) {
sendMessage_1.default(context, '❌ 綁定失敗');
return;
throw Error("\u5E33\u865F\u7D81\u5B9A\u5931\u6557: " + err);
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/controller/notifiesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class NotifyController {
$notify.userId = userId;
if (!isAlive) {
$notify.save(err => {
if (err) throw err;
if (err) throw Error(`Notify 儲存失敗: ${err}`);
});
} else {
const userObj = {
Expand All @@ -46,7 +46,7 @@ class NotifyController {
{ userId: userId },
userObj,
(err, _) => {
if (err) console.log(err);
if (err) throw Error(`Notify 更新失敗: ${err}`);
}
);
}
Expand Down

0 comments on commit 60cdbcd

Please sign in to comment.