How to use the vk-io.VKError function in vk-io

To help you get started, we’ve selected a few vk-io examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github negezor / vk-io / packages / authorization / src / providers / implicit-flow-groups.ts View on Github external
constructor(vk: VK, options: IImplicitFlowOptions & { groups: number[] }) {
		super(vk, options);

		let { groups = null } = options;

		if (groups === null) {
			throw new VKError({
				message: 'Groups list must have',
				code: 'GROUPS_NOT_SET'
			});
		}

		if (!Array.isArray(groups)) {
			groups = [groups];
		}

		this.groups = groups.map((rawGroup) => {
			const group = Number(rawGroup);

			return group < 0
				? -group
				: group;
		});