Unchecked runtime.lastError while running tabs.executeScript?

“Check” runtime.lastError by “reading” it in the callback.


Code

chrome.tabs.executeScript(tabId, {
  //..
}, _=>chrome.runtime.lastError /* "check" error */)

Eg

Show it via..

chrome.tabs.executeScript(tabId, {
  //..
}, _=>{
  let e = chrome.runtime.lastError;
  if(e !== undefined){
    console.log(tabId, _, e);
  }
});

Leave a Comment