Table of Contents

Class ServiceResult

Namespace
Tudormobile.OpenTrivia.UI.Services
Assembly
Tudormobile.OpenTrivia.UI.dll

Provides non-generic helper methods for creating ServiceResult instances.

public static class ServiceResult
Inheritance
ServiceResult
Inherited Members

Methods

Failure<T>(Exception)

Creates a failed result from an exception.

public static ServiceResult<T> Failure<T>(Exception exception)

Parameters

exception Exception

The exception that caused the failure.

Returns

ServiceResult<T>

A failed service result containing the exception message and exception.

Type Parameters

T

The type of data the result would have contained on success.

Failure<T>(string)

Creates a failed result with the specified error message.

public static ServiceResult<T> Failure<T>(string errorMessage)

Parameters

errorMessage string

The error message describing the failure.

Returns

ServiceResult<T>

A failed service result containing the error message.

Type Parameters

T

The type of data the result would have contained on success.

Failure<T>(string, Exception?)

Creates a failed result with the specified error message and exception.

public static ServiceResult<T> Failure<T>(string errorMessage, Exception? exception)

Parameters

errorMessage string

The error message describing the failure.

exception Exception

The exception that caused the failure, if any.

Returns

ServiceResult<T>

A failed service result containing the error information.

Type Parameters

T

The type of data the result would have contained on success.

Success<T>(T)

Creates a successful result with the specified data.

public static ServiceResult<T> Success<T>(T data)

Parameters

data T

The data to include in the result.

Returns

ServiceResult<T>

A successful service result containing the data.

Type Parameters

T

The type of data in the result.