InvalidStateError
InvalidStateError is the name of a DOMException used in web platform APIs to indicate that an operation cannot be performed in the object's current state. It is part of the standard set of DOMException error names used by APIs to signal state-related constraints.
The error is defined in the DOM specifications as a way for APIs to communicate that a
When it occurs, a method or API call throws (or returns a rejected promise with) InvalidStateError because
Representation and handling: In JavaScript, InvalidStateError is usually represented as a DOMException with the name property
See also: DOMException, NotFoundError, NotAllowedError, NotSupportedError, ConstraintError.