title: How to catch DOMException in Chrome?
body: <p>I get this error:</p>
  
  <pre><code>Uncaught (in promise) DOMException: lockOrientation() is not available on this device.
    code: 9
    message: "lockOrientation() is not available on this device."
    name: "NotSupportedError"
  </code></pre>
  
  <p>when I run the following code in Chrome:</p>
  
  <pre class="lang-js prettyprint-override"><code>try {
    screen.orientation.lock('portrait');
  } catch (error) {
    // whatever
  }
  </code></pre>
  
  <p>The fact that the error is being thrown is expected, since Desktop Chrome doesn't support orientation locking. I'd like to catch the error so it doesn't litter the console, but wrapping it in a <code>try...catch</code> block doesn't seem to work.</p>
  
  <p>Why can't I catch it? Am I missing something?</p>