Skip to main content
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
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

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