mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Unify result
This commit is contained in:
parent
4e80c15820
commit
84cc45d9af
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user