title: chrome.runtime.lastError is coming as 'UNDEFINED' despite of fetching an unset variable from chrome local storage,
body: <p>I am trying to check if the key, value pair has been set in the chrome.storage.local. for that i took the help of a similar kind of problem <a href="https://stackoverflow.com/questions/14982560/using-a-variable-key-in-chrome-storage-local-set">here</a>. Here the variable i'm trying to get from storage has not been set by me. When i try to catch the error using <strong>lastError</strong>. It is coming as undefined, whereas it was suppose to defined and set due to error in reading a variable that has not been set previously ( as per what i googled). Please help me to detect the error while reading a variable that has not been set.</p>
  
  <p><strong>manifest.json</strong></p>
  
  <pre><code>{
      "name": "TestExtension",
      "version": "1.0",
      "manifest_version": 2,
      "background": {
          "scripts": ["jquery.js", "background.js"]
      },
  
      "description": "Test the extension features here",
      "icons": {
          "16": "images/16x16.png",
          "48": "images/48x48.png",
          "128": "images/128x128.png"
      },
  
      "page_action": {
          "default_icon": {
              "19": "images/19x19.png",
              "38": "images/38x38.png"
          },
          "default_title": "Test Plugin default title",
          "default_popup": "popup.html"
      },
  
      "permissions": ["tabs", "storage", "http://*/*", "https://*/*"]
  }
  </code></pre>
  
  <p><strong>background.js</strong></p>
  
  <pre><code>function showTheExtension(tabId, changeInfo, tab) {
      console.log("Extension loaded");
      chrome.pageAction.show(tabId);
  } // ---EOF checkForValidUrl---
  chrome.tabs.onUpdated.addListener(showTheExtension);
  </code></pre>
  
  <p><strong>popup.js</strong></p>
  
  <pre><code>$('document').ready(function() {
      chrome.storage.local.get('testVar1', function(result) {
          if (chrome.runtime.lastError) {
              alert('Var not set')
          }
          console.log(result);
          console.log(chrome.runtime.lastError.message);
      });
  });
  </code></pre>
  
  <p><strong>popup.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Page Title&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;h3&gt;Welcome to the test project for designing chrome plugins&lt;/h3&gt;
  
  &lt;script type="application/x-javascript" src="./jquery.js"&gt;&lt;/script&gt;
  &lt;script type="application/x-javascript" src="./popup.js"&gt;&lt;/script&gt;
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>