Skip to main content
Pentaho Documentation

ArgumentRequiredError

pentaho.lang.ArgumentRequiredError

The ArgumentRequiredError class is the class of errors for a function's argument that was required but was not specified, or was specified but with a nully or empty value.

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

An argument being "required" may mean that an argument must be:

  • Specified: if(arguments.length < 1) ...
  • Truthy: if(!value) ...
  • Not nully: if(value == null) ...
  • Not nully or an empty string: if(value == null || value === "") ...

AMD Module

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

Extends

Constructor

Name Description
new ArgumentRequiredError(name, text)

Creates a required argument error object.

Members

Name Description
name : string

The name of the type of error.

Constructor Details

new ArgumentRequiredError(name, text)

Creates a required argument error object.

Source: javascript/web/pentaho/lang/ArgumentRequiredError.js, line 25

Parameters:
Name Default Value Summary
name : string

The name of the argument.

text : string
 
Optional

Optional text further explaining the reason why the argument is required. Can be useful when "being required" is a dynamic rule.

Example

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

 function connect(channel) {

 if(channel && channel.isOpened) {
 throw new ArgumentRequiredError("channel", "Channel not free to use.");
 }

 var handle = channel.open();
 // ...
 }

 // ...
});

Members Details

name: string

The name of the type of error.

Source: javascript/web/pentaho/lang/ArgumentRequiredError.js, line 79

Default Value: "ArgumentRequiredError"

Overrides: pentaho.lang.ArgumentError#name