ValidationFail
Exception raised by Input validations.
It carries additional information about the context of the error that can be used when reporting/handling it. For this reason when this exception handled by a Handler it gets encoded into json ValidationFail.toJSON.
throw new ValidationFail('File does not exit!')
Static Method Summary
Static Public Methods | ||
public static |
fromJSON(json: string): ValidationFail Creates a ValidationFail instance based on the input json string |
Constructor Summary
Public Constructor | ||
public |
constructor(message: string, code: string, inputName: string) Initialize the exception |
Member Summary
Public Members | ||
public set |
Sets an unique error code specifically related with that has failed validation, this information can be used later to identify the origin of the error, instead of trying to parse the message to figure out that information. |
|
public get |
Returns the code related with the validation itself |
|
public |
Boolean telling if this error is not allowed as output (Handler.output) when it has been raised from a nested action (an action created from another action (Action.createAction)). |
|
public set |
Sets the input name related with the validation |
|
public get |
Returns the input name related with the validation |
|
public |
Status code used by the Handler when this error is raised from inside of a top level action (an action that has not been created from another action). |
Inherited Summary
From class MeboError | ||
public |
Boolean telling if this error is not allowed as output (Handler.output) when it has been raised from a nested action (an action created from another action (Action.createAction)). |
|
public |
Status code used by the Handler when this error is raised from inside of a top level action (an action that has not been created from another action). |
Static Public Methods
public static fromJSON(json: string): ValidationFail source
Creates a ValidationFail instance based on the input json string
Params:
Name | Type | Attribute | Description |
json | string | string containing the serialized json version of the exception |
Public Constructors
Public Members
public set code(errorCode: string): * source
Sets an unique error code specifically related with that has failed validation, this information can be used later to identify the origin of the error, instead of trying to parse the message to figure out that information.
public disableOutputInNested: boolean source
Boolean telling if this error is not allowed as output (Handler.output) when it has been raised from a nested action (an action created from another action (Action.createAction)). When output is disabled the error will not be handled by the Writer, therefore the error will be emitted by the signal Handler.onErrorDuringOutput.
Value driven by:
Settings.get('error/validationFail/disableOutputInNested')
(default: true
)
Override:
MeboError#disableOutputInNestedpublic status: number source
Status code used by the Handler when this error is raised from inside of a top level action (an action that has not been created from another action).
Value driven by:
Settings.get('error/validationFail/status')
(default: 400
)