javascript - How can I catch JS exceptions from async functions I don't control? -
i know using try..catch
async functions doesn't work, , advice i've read suggests using inside passed callback.
however, without control on async function throws exception, can 1 catch it? in example it's chrome.bookmarks.create
, fails on edge cases.
in chrome extensions, there 3 possible ways of catching asynchronous errors:
- listen global error events using
window.onerror
. - in callback of asynchronous functions, check value of
chrome.runtime.lasterror
.
Comments
Post a Comment