Share via


OperationResult class

Represents the result of an operation.

Properties

errors

Gets an array of OperationError instances indicating errors that occurred during the operation.

succeeded

Gets a flag indicating whether the operation succeeded.

success

Returns an OperationResult indicating a successful operation.

Methods

failed(OperationError[])

Creates an OperationResult indicating a failed operation, with a list of errors if applicable.

toString()

Converts the value of the current OperationResult object to its equivalent string representation.

Property Details

errors

Gets an array of OperationError instances indicating errors that occurred during the operation.

OperationError[] errors

Property Value

succeeded

Gets a flag indicating whether the operation succeeded.

succeeded: boolean

Property Value

boolean

success

Returns an OperationResult indicating a successful operation.

static OperationResult success

Property Value

Method Details

failed(OperationError[])

Creates an OperationResult indicating a failed operation, with a list of errors if applicable.

static function failed(errors: OperationError[]): OperationResult

Parameters

errors

OperationError[]

An optional array of OperationError which caused the operation to fail.

Returns

An OperationResult indicating a failed operation, with a list of errors if applicable.

toString()

Converts the value of the current OperationResult object to its equivalent string representation.

function toString(): string

Returns

string

A string representation of the current OperationResult object.

Remarks

If the operation was successful the toString() will return "Succeeded" otherwise it will return "Failed : " followed by a comma delimited list of error messages from its errors collection, if any.