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
exceptionExceptionThe exception that caused the failure.
Returns
- ServiceResult<T>
A failed service result containing the exception message and exception.
Type Parameters
TThe 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
errorMessagestringThe error message describing the failure.
Returns
- ServiceResult<T>
A failed service result containing the error message.
Type Parameters
TThe 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
errorMessagestringThe error message describing the failure.
exceptionExceptionThe exception that caused the failure, if any.
Returns
- ServiceResult<T>
A failed service result containing the error information.
Type Parameters
TThe 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
dataTThe data to include in the result.
Returns
- ServiceResult<T>
A successful service result containing the data.
Type Parameters
TThe type of data in the result.