UNPKG

534 BJavaScriptView Raw
1module.exports = class SriClientError {
2 constructor(obj) {
3 if(obj.originalResponse) {
4 this.response = obj.originalResponse;
5 } else {
6 this.object = obj;
7 }
8 this.status = obj.status;
9 this.body = obj.body;
10 this.headers = obj.headers;
11 this.error = obj.error;
12 this.stack = obj.stack;
13 }
14
15 getStatusCode() {
16 return this.status;
17 };
18
19 getResponseHeader(header) {
20 return this.headers[header];
21 }
22
23 print() {
24 return {
25 status: this.status,
26 body: this.body
27 };
28 }
29};
\No newline at end of file