Home Manual Reference Source Repository
public class | since 0.0.1 | source

ArgumentTypeError

Extends:

ErrorArgumentError → ArgumentTypeError

Represents that an argument has an invalid type or an object with the incorrect structure.

Throw this Error if a parameter has an invalid type and can't be represented by a more specific argument error.

See:

Example:

The argument for the parameter motor is missing a property.
throw new ArgumentTypeError(
   'motor', `The argument is not a valid 'Motor'. It lacks the 'start' method`);

Static Method Summary

Static Protected Methods
protected static

makeTypeMessage({!string}:: *, {string}:: *): *

Builds a default error message for subclasses.

since 0.0.1

Constructor Summary

Public Constructor
public

constructor(type: string, name: string, message: string)

Initializes a new instance of the ArgumentTypeError class.

since 0.0.1

Static Protected Methods

protected static makeTypeMessage({!string}:: *, {string}:: *): * since 0.0.1 source

Builds a default error message for subclasses.

Params:

NameTypeAttributeDescription
{!string}: *

type - The expected parameter type.

{string}: *

[message] - Specified message. Otherwise, a generic message will be created like Argument must have type '${type}'. Yours is not.

Return:

*

Public Constructors

public constructor(type: string, name: string, message: string) since 0.0.1 source

Initializes a new instance of the ArgumentTypeError class.

Override:

ArgumentError#constructor

Params:

NameTypeAttributeDescription
type string
  • nullable: false

The expected parameter type.

name string
  • optional

The parameter name. Default is no name.

message string
  • optional

Specified message. Otherwise, a generic message will be used like Argument must have type '${type}'. Yours is not.