Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields
InputException Class Reference
Inheritance diagram for InputException:
AbstractAggregateException LocalizedException AggregateExceptionInterface GraphQlInputException OauthInputException Exception

Public Member Functions

 __construct (Phrase $phrase=null, \Exception $cause=null, $code=0)
 
- Public Member Functions inherited from AbstractAggregateException
 __construct (Phrase $phrase, \Exception $cause=null, $code=0)
 
 addError (Phrase $phrase)
 
 addException (LocalizedException $exception)
 
 wasErrorAdded ()
 
 getErrors ()
 
- Public Member Functions inherited from LocalizedException
 __construct (Phrase $phrase, \Exception $cause=null, $code=0)
 
 getRawMessage ()
 
 getParameters ()
 
 getLogMessage ()
 

Static Public Member Functions

static invalidFieldValue ($fieldName, $fieldValue, \Exception $cause=null)
 
static requiredField ($fieldName)
 

Data Fields

const DEFAULT_MESSAGE = 'One or more input exceptions have occurred.'
 
const INVALID_FIELD_RANGE = 'The %fieldName value of "%value" must be between %minValue and %maxValue'
 
const INVALID_FIELD_MIN_VALUE = 'The %fieldName value of "%value" must be greater than or equal to %minValue.'
 
const INVALID_FIELD_MAX_VALUE = 'The %fieldName value of "%value" must be less than or equal to %maxValue.'
 
const INVALID_FIELD_VALUE = 'Invalid value of "%value" provided for the %fieldName field.'
 
const REQUIRED_FIELD = '"%fieldName" is required. Enter and try again.'
 

Additional Inherited Members

- Protected Attributes inherited from AbstractAggregateException
 $errors = []
 
 $originalPhrase
 
- Protected Attributes inherited from LocalizedException
 $phrase
 
 $logMessage
 

Detailed Description

Exception to be thrown when there is an issue with the Input to a function call.

@api

Since
100.0.2

Definition at line 17 of file InputException.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Phrase  $phrase = null,
\Exception  $cause = null,
  $code = 0 
)

Initialize the input exception.

Parameters
\Magento\Framework\Phrase$phrase
\Exception$cause
int$code

Definition at line 56 of file InputException.php.

57  {
58  if ($phrase === null) {
59  $phrase = new Phrase('One or more input exceptions have occurred.');
60  }
61  parent::__construct($phrase, $cause, $code);
62  }
$code
Definition: info.phtml:12

Member Function Documentation

◆ invalidFieldValue()

static invalidFieldValue (   $fieldName,
  $fieldValue,
\Exception  $cause = null 
)
static

Creates an InputException for when a specific field was provided with an invalid value.

Parameters
string$fieldNameName of the field which had an invalid value provided.
string$fieldValueThe invalid value that was provided for the field.
\Exception$causeCause of the InputException
Returns
\Magento\Framework\Exception\InputException

Definition at line 72 of file InputException.php.

73  {
74  return new self(
75  new Phrase(
76  'Invalid value of "%value" provided for the %fieldName field.',
77  ['fieldName' => $fieldName, 'value' => $fieldValue]
78  ),
79  $cause
80  );
81  }

◆ requiredField()

static requiredField (   $fieldName)
static

Creates an InputException for a missing required field.

Parameters
string$fieldNameName of the missing required field.
Returns
\Magento\Framework\Exception\InputException

Definition at line 89 of file InputException.php.

90  {
91  return new self(
92  new Phrase('"%fieldName" is required. Enter and try again.', ['fieldName' => $fieldName])
93  );
94  }

Field Documentation

◆ DEFAULT_MESSAGE

const DEFAULT_MESSAGE = 'One or more input exceptions have occurred.'
Deprecated:

Definition at line 22 of file InputException.php.

◆ INVALID_FIELD_MAX_VALUE

const INVALID_FIELD_MAX_VALUE = 'The %fieldName value of "%value" must be less than or equal to %maxValue.'
Deprecated:

Definition at line 37 of file InputException.php.

◆ INVALID_FIELD_MIN_VALUE

const INVALID_FIELD_MIN_VALUE = 'The %fieldName value of "%value" must be greater than or equal to %minValue.'
Deprecated:

Definition at line 32 of file InputException.php.

◆ INVALID_FIELD_RANGE

const INVALID_FIELD_RANGE = 'The %fieldName value of "%value" must be between %minValue and %maxValue'
Deprecated:

Definition at line 27 of file InputException.php.

◆ INVALID_FIELD_VALUE

const INVALID_FIELD_VALUE = 'Invalid value of "%value" provided for the %fieldName field.'
Deprecated:

Definition at line 42 of file InputException.php.

◆ REQUIRED_FIELD

const REQUIRED_FIELD = '"%fieldName" is required. Enter and try again.'
Deprecated:

Definition at line 47 of file InputException.php.


The documentation for this class was generated from the following file: