Skip to content

Commit

Permalink
Merge bd81cc6 into 7ffecf9
Browse files Browse the repository at this point in the history
  • Loading branch information
hassanRafi committed Jul 26, 2019
2 parents 7ffecf9 + bd81cc6 commit ef38159
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions website/common/script/libs/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ export class NotFound extends CustomError {
}
}

export class ForBidden extends CustomError {
constructor (customMessage) {
super();
this.name = this.constructor.name;
this.httpCode = 403;
this.message = customMessage || 'Forbidden.';
}
}

export class NotImplementedError extends CustomError {
constructor (str) {
super();
Expand Down
4 changes: 4 additions & 0 deletions website/common/script/ops/sell.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ module.exports = function sell (user, req = {}) {
throw new NotFound(i18n.t('userItemsKeyNotFound', {type}, req.language));
}

if (key === 'Saddle') {
throw new ForBidden(i18n.t('userItemsKeyRare', req.language));
}

let currentAmount = user.items[type][key];

if (amount > currentAmount) {
Expand Down

0 comments on commit ef38159

Please sign in to comment.