fix: linting
This commit is contained in:
@@ -24,7 +24,7 @@ module.exports = class RequestUtil {
|
||||
|
||||
this.baseUrl = baseUrls[livenet === true ? 'livenet' : 'testnet'];
|
||||
if (options.baseUrl) {
|
||||
this.baseUrl = options.baseUrl
|
||||
this.baseUrl = options.baseUrl;
|
||||
}
|
||||
|
||||
this.globalRequestOptions = {
|
||||
@@ -35,7 +35,7 @@ module.exports = class RequestUtil {
|
||||
headers: {
|
||||
Referer: 'bybitapinode'
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
if (key) {
|
||||
assert(secret, 'Secret is required for private enpoints');
|
||||
@@ -108,27 +108,27 @@ module.exports = class RequestUtil {
|
||||
requestOptions: options
|
||||
};
|
||||
})
|
||||
.catch(e => {
|
||||
if (!e.response) {
|
||||
.catch(e => {
|
||||
if (!e.response) {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
if (!e.request) {
|
||||
throw e.message;
|
||||
if (!e.request) {
|
||||
throw e.message;
|
||||
}
|
||||
|
||||
// request made but no response received
|
||||
throw e;
|
||||
}
|
||||
|
||||
// request made but no response received
|
||||
throw e;
|
||||
}
|
||||
|
||||
// The request was made and the server responded with a status code
|
||||
// that falls out of the range of 2xx
|
||||
throw {
|
||||
code: e.response.statusCode,
|
||||
message: e.response.message,
|
||||
body: e.response.body,
|
||||
requestOptions: options,
|
||||
headers: e.response.headers
|
||||
};
|
||||
});
|
||||
// The request was made and the server responded with a status code
|
||||
// that falls out of the range of 2xx
|
||||
throw {
|
||||
code: e.response.statusCode,
|
||||
message: e.response.message,
|
||||
body: e.response.body,
|
||||
requestOptions: options,
|
||||
headers: e.response.headers
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
_signRequest(data) {
|
||||
@@ -156,14 +156,9 @@ module.exports = class RequestUtil {
|
||||
return this._syncTimePromise;
|
||||
}
|
||||
|
||||
this._syncTimePromise = new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
this._timeOffset = await this.getTimeOffset();
|
||||
this._syncTimePromise = null;
|
||||
resolve();
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
this._syncTimePromise = this.getTimeOffset().then(offset => {
|
||||
this._timeOffset = offset;
|
||||
this._syncTimePromise = null;
|
||||
});
|
||||
|
||||
return this._syncTimePromise;
|
||||
|
||||
Reference in New Issue
Block a user