Merge pull request #2665 from 0xProject/smaller_log

Smaller logs (avoid circular buffers) + add a boolean to indicate if order was included in the salad or not
This commit is contained in:
Daniel Pyrathon 2020-08-14 17:02:35 -07:00 committed by GitHub
commit 15ce90c0ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,8 +86,29 @@ function hasExpectedAssetData(
}
function convertIfAxiosError(error: any): Error | object /* axios' .d.ts has AxiosError.toJSON() returning object */ {
if (error.hasOwnProperty('isAxiosError') && error.isAxiosError && error.hasOwnProperty('toJSON')) {
return error.toJSON();
if (error.hasOwnProperty('isAxiosError') && error.isAxiosError) {
const { message, name, config } = error;
const { headers, timeout, httpsAgent } = config;
const { keepAlive, keepAliveMsecs, sockets } = httpsAgent;
const socketCounts: { [key: string]: number } = {};
for (const socket of Object.keys(sockets)) {
socketCounts[socket] = sockets[socket].length;
}
return {
message,
name,
config: {
headers,
timeout,
httpsAgent: {
keepAlive,
keepAliveMsecs,
socketCounts,
},
},
};
} else {
return error;
}
@ -351,6 +372,7 @@ export class QuoteRequestor {
rfqtMakerInteraction: {
...partialLogEntry,
response: {
included: true,
statusCode: response.status,
latencyMs: Date.now() - timeBeforeAwait,
},
@ -362,6 +384,7 @@ export class QuoteRequestor {
rfqtMakerInteraction: {
...partialLogEntry,
response: {
included: false,
statusCode: err.response ? err.response.status : undefined,
latencyMs: Date.now() - timeBeforeAwait,
},