feat(DiscordAPIError): backport method property (#2536)

This commit is contained in:
Kyra
2018-05-03 22:47:50 +02:00
committed by SpaceEEC
parent a89de09855
commit 8700e965c5
3 changed files with 11 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
* @extends Error
*/
class DiscordAPIError extends Error {
constructor(path, error) {
constructor(path, error, method) {
super();
const flattened = this.constructor.flattenErrors(error.errors || error).join('\n');
this.name = 'DiscordAPIError';
@@ -20,6 +20,12 @@ class DiscordAPIError extends Error {
* @type {number}
*/
this.code = error.code;
/**
* The HTTP method used for the request
* @type {string}
*/
this.method = method;
}
/**