extension-port-stream
extension-port-stream copied to clipboard
fix: check runtime.lastError and turn into warnings
fixes https://github.com/MetaMask/metamask-extension/issues/14987
fixes #22
runtime.lastError needs to be checked when doing callback-based async things: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/lastError https://developer.chrome.com/docs/extensions/reference/runtime/
By just reading the value, the error message goes away. In the case of disconnect, lastError is set when there was an error disconnecting.
Typically we don't use console
in libraries, so that the parent project can better control what gets printed to their console.
Could we forward this error to the caller instead, letting it decide how to handle the error? That's what #22 is attempting to do I believe.