Unify result

This commit is contained in:
Mariusz Nowak 2019-07-19 16:08:26 +02:00
parent 4e80c15820
commit 84cc45d9af
No known key found for this signature in database
GPG Key ID: B1FBDA8A182B03F2

View File

@ -33,9 +33,12 @@ const logError = (type, error) => {
};
const processResponseBody = (response, id) => {
return response.buffer().catch(error => {
logError(`Response processing error for ${id}`, error);
});
return response.buffer().then(
() => {}, // For consistency do not expose any result
error => {
logError(`Response processing error for ${id}`, error);
}
);
};
/* note tracking swallows errors */
@ -62,7 +65,9 @@ function request(type, event, { id, timeout } = {}) {
});
});
},
networkError => logError('Request network error', networkError)
networkError => {
logError('Request network error', networkError);
}
);
}
@ -93,7 +98,7 @@ function track(type, event, options = {}) {
});
}),
request(type, event, { id }),
]);
]).then(([, requestResult]) => requestResult); // In all cases resolve with request result
});
}