microsoft.opentelemetry.a365.runtime.operation_result module

Represents the result of an operation.

class microsoft.opentelemetry.a365.runtime.operation_result.OperationResult(succeeded, errors=None)[source]

Bases: object

Represents the result of an operation.

This class encapsulates the success or failure state of an operation along with any associated errors.

property succeeded: bool

Get a flag indicating whether the operation succeeded.

Returns:

True if the operation succeeded, otherwise False.

Return type:

bool

property errors: List[OperationError]

Get the list of errors that occurred during the operation.

Note

This property returns a defensive copy of the internal error list to prevent external modifications, which is especially important for protecting the singleton instance returned by success().

Returns:

A copy of the list of operation errors.

Return type:

List[OperationError]

static success()[source]

Return an OperationResult indicating a successful operation.

Returns:

An OperationResult indicating a successful operation.

Return type:

OperationResult

static failed(*errors)[source]

Create an OperationResult indicating a failed operation.

Parameters:

*errors (OperationError) – Variable number of OperationError instances.

Returns:

An OperationResult indicating a failed operation.

Return type:

OperationResult