Skip to main content
Hitachi Vantara Lumada and Pentaho Documentation

ArgumentInvalidTypeError

pentaho.lang. ArgumentInvalidTypeError

The ArgumentInvalidTypeError class is the class of errors for a function's argument that has been specified, although with a value of an unsupported type, according to the documented contract.

The name of the argument can be that of a nested property. For example: "keyArgs.description".

Types can be:

  • One of the possible results of the typeof operator. For example: "number", "string", "boolean", "function".
  • The name of global classes/constructors, that would be testable by use of the instanceof operator or by accessing the constructor property. For example: "Array", "Object", or "HTMLElement".
  • The identifier of an AMD module that returns a constructor or factory. For example: "pentaho/type/Complex".

AMD Module

require(["pentaho/lang/ArgumentInvalidTypeError"], function(ArgumentInvalidTypeError) { /* code goes here */ });

Extends

Constructor

Name Description
new ArgumentInvalidTypeError(name, expectedType, actualType)

Creates an invalid argument type error object.

Members

Name Description
argument :  string

The name of the associated argument.

actualType :  nonEmptyString

The name of the received type, when known.

expectedTypes :  Array.<nonEmptyString>

The names of the expected types.

name :  string

The name of the type of error.

Constructor Details

new ArgumentInvalidTypeError(name, expectedType, actualType)

Creates an invalid argument type error object.

Source: javascript/web/pentaho/lang/ArgumentInvalidTypeError.js, line 26

Parameters:
Name Default Value Summary
name : string

The name of the argument.

expectedType : string | Array.<string>

The name or names of the expected types.

actualType : string
Optional

The name of the received type, when known.

Example

define(["pentaho/lang/ArgumentInvalidTypeError"], function(ArgumentInvalidTypeError) {

 function createInstance(type, args) {
 var TypeCtor;

 switch(typeof type) {
 case "string":
 TypeCtor = window[type];
 break;

 case "function":
 TypeCtor = type;
 break;

 default:
 throw new ArgumentInvalidTypeError("type", ["string", "function"], typeof type);
 }

 // ...
 }

 // ...
});

Members Details

argument:  string

The name of the associated argument.

Source: javascript/web/pentaho/lang/ArgumentError.js, line 49

Inherited From: pentaho.lang.ArgumentError#constructor#argument

actualType:  nonEmptyString

The name of the received type, when known.

Source: javascript/web/pentaho/lang/ArgumentInvalidTypeError.js, line 105

expectedTypes:  Array.<nonEmptyString>

The names of the expected types.

Source: javascript/web/pentaho/lang/ArgumentInvalidTypeError.js, line 112

name:  string

The name of the type of error.

Source: javascript/web/pentaho/lang/ArgumentInvalidTypeError.js, line 122

Default Value: "ArgumentInvalidTypeError"

Overrides: pentaho.lang.ArgumentError#name