Skip to content

isDOMException ​

The isDOMException function checks if a value is an instance of DOMException.

Syntax ​

typescript
isDOMException(value: any): value is DOMException;

Parameters ​

NameTypeDescription
valueanyThe value to check

Returns ​

TypeDescription
booleantrue if the value is an instance of DOMException, false otherwise

Examples ​

typescript
isDOMException(new DOMException("DOM error"));
// => true

isDOMException(new Error());
// => false

isDOMException({});
// => false

Notes ​

  • Useful for identifying exceptions related to the DOM API in compatible environments.

References ​

Released under the MIT License.