UNPKG

gmopg

Version:

GMO PaymentGateway API client

24 lines (23 loc) 677 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const errorDefinition = require('../error-codes.json'); class BadRequest extends Error { constructor(message) { super(message); this.name = this.constructor.name; Error.captureStackTrace(this, this.constructor); } setResponse(obj) { this.response = obj; return this; } parseError(obj) { this.errInfo = obj.ErrInfo.split('|'); this.errors = this.errInfo.map((code) => errorDefinition[code]); return this; } toString() { return `${this.name}: ${this.message}`; } } exports.BadRequest = BadRequest;