mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
Errors Standardization (#1246)
* errors and stuff * more errors * all the errors * fix build
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const Constants = require('../util/Constants');
|
||||
const { RangeError } = require('../errors');
|
||||
|
||||
/**
|
||||
* Data structure that makes it easy to interact with a permission bitfield. All {@link GuildMember}s have a set of
|
||||
@@ -95,7 +95,7 @@ class Permissions {
|
||||
static resolve(permission) {
|
||||
if (permission instanceof Array) return permission.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0);
|
||||
if (typeof permission === 'string') permission = this.FLAGS[permission];
|
||||
if (typeof permission !== 'number' || permission < 1) throw new RangeError(Constants.Errors.NOT_A_PERMISSION);
|
||||
if (typeof permission !== 'number' || permission < 1) throw new RangeError('PERMISSION_INVALID');
|
||||
return permission;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user