@ikonintegration/ikapi 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonintegration/ikapi",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "main.js",
@@ -56,7 +56,16 @@ export default class IKResponse {
56
56
  //log response and respond to context
57
57
  transaction.logger.debug(this._body)
58
58
  if (this.getCode() <= 200 && this.getCode() <= 299) context.succeed(this._body);
59
- else context.fail(this._body);
59
+ else {
60
+ //
61
+ function CustomError(message) {
62
+ this.name = this._body && this._body.error ? this._body.error : 'UnknownError';
63
+ this.message = message;
64
+ }
65
+ CustomError.prototype = new Error();
66
+ //
67
+ context.fail(new CustomError(this.body));
68
+ }
60
69
  }
61
70
  }
62
71