Logger API error handling improvement

Summary: Defer Logger calls to the next tick queue so as to avoid potential Logger errors from falling under the purview of Promise error handling, which would degrade development experience by "swallowing" legitimate runtime errors within rejected promises, to the infuriation of us all :D

Reviewed By: davidaurelio

Differential Revision: D4197869

fbshipit-source-id: 10a44904be1404ad2534d06ddc56048c1c24f32b
This commit is contained in:
Ovidiu Viorel Iepure 2016-11-21 05:57:36 -08:00 committed by Facebook Github Bot
parent d117f550a5
commit 27817bed0e
1 changed files with 6 additions and 2 deletions

View File

@ -475,7 +475,9 @@ class Server {
// This is safe as the asset url contains a hash of the asset.
res.setHeader('Cache-Control', 'max-age=31536000');
res.end(this._rangeRequestMiddleware(req, res, data, assetPath));
print(log(createActionEndEntry(processingAssetRequestLogEntry)), ['asset']);
process.nextTick(() => {
print(log(createActionEndEntry(processingAssetRequestLogEntry)), ['asset']);
});
},
error => {
console.error(error.stack);
@ -747,7 +749,9 @@ class Server {
}).then(
stack => {
res.end(JSON.stringify({stack: stack}));
print(log(createActionEndEntry(symbolicatingLogEntry)));
process.nextTick(() => {
print(log(createActionEndEntry(symbolicatingLogEntry)));
});
},
error => {
console.error(error.stack || error);