javascript-collections-framework
    Preparing search index...

    Class IllegalArgumentError

    Thrown when an argument has a value the operation cannot accept, such as a range whose start is after its end.

    Extends RangeError. Match it with instanceof, not by name or message text: the message names the method and the problem, but its wording may change in any release.

    Time: O(1) to construct, plus the runtime's stack capture.

    try {
    throw new IllegalArgumentError('Grid.rows: from 3 is greater than to 1 for size 4')
    } catch (error) {
    if (error instanceof IllegalArgumentError) {
    // handle it
    }
    }

    Hierarchy

    • RangeError
      • IllegalArgumentError
    Index
    • Creates the error.

      Parameters

      • Optionalmessage: string

        What went wrong, in the form Class.method: problem.

      Returns IllegalArgumentError

    message: string
    name: string
    stack?: string
    • get "[ILLEGAL_ARGUMENT_ERROR_BRAND]"(): true

      Marks instances of this class so instanceof recognises them across copies of the package. Its key is not exported, so the getter is not called directly. Time: O(1).

      Returns true

    • Returns whether value is an instance of this class, including instances created by another copy of the library with the same major version.

      Time: O(1); O(prototype-chain depth) when evaluated against a subclass.

      Parameters

      • value: unknown

        The value on the left of instanceof.

      Returns boolean

      true when value carries this class's brand; when evaluated against a subclass, true when the subclass's prototype is in value's prototype chain.

      value instanceof IllegalArgumentError // also true for an instance made by another copy of the package