'How to handle a rejected call to `screen.orientation.unlock()` on firefox?

The spec states that a call to screen.orientation.unlock() returns void.

However Firefox throws an internal "Not supported" exception on the desktop browser.

Because nothing is returned, the following approaches do not appear to work:

screen
  .orientation.unlock()
  .catch(error => console.error('[Screen orientation]', error))
try {
  screen.orientation.unlock()
} catch (error) {
  console.error('[Screen orientation]', error)
}

Is there a way to handle / suppress this error?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source