use tryCatch to simplify 7e5396a1

This commit is contained in:
tophf 2017-08-30 18:05:22 +03:00
parent 3c5d20f862
commit c88438c6eb

View File

@ -306,13 +306,7 @@ function updateIcon(tab, styles) {
function onRuntimeMessage(request, sender, sendResponse) { function onRuntimeMessage(request, sender, sendResponse) {
// prevent browser exception bug on sending a response to a closed tab // prevent browser exception bug on sending a response to a closed tab
sendResponse = (sendResponseOriginal => sendResponse = (send => data => tryCatch(send, data))(sendResponse);
data => {
try {
sendResponseOriginal(data);
} catch (e) {}
}
)(sendResponse);
switch (request.method) { switch (request.method) {
case 'getStyles': case 'getStyles':
getStyles(request).then(sendResponse); getStyles(request).then(sendResponse);