Class AppErrorService
Provides methods to manage application errors.
Implements
Inherited Members
Namespace: DataWeb.Error
Assembly: DataWeb.Core.dll
Syntax
public class AppErrorService : IAppErrorService
Remarks
Initializes a new instance of the AppErrorService class with the specified error store.
Constructors
AppErrorService(IAppErrorStore)
Provides methods to manage application errors.
Declaration
public AppErrorService(IAppErrorStore errorStore)
Parameters
Type | Name | Description |
---|---|---|
IAppErrorStore | errorStore | The IAppErrorStore error store. |
Remarks
Initializes a new instance of the AppErrorService class with the specified error store.
Methods
GetErrorAsync(string, CancellationToken)
Retrieves an error with the specified Id asynchronously.
Declaration
public Task<AppError> GetErrorAsync(string id, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The Id of the error to retrieve. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<AppError> | An AppError object if found, otherwise null. |
GetErrorsAsync(CancellationToken)
Retrieves all errors asynchronously.
Declaration
public Task<IEnumerable<AppError>> GetErrorsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<AppError>> | A collection of AppError objects. |
GetErrorsCountAsync(CancellationToken)
Retrieves the count of all errors asynchronously.
Declaration
public Task<long> GetErrorsCountAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<long> | The count of all errors. |
RemoveAllAsync(CancellationToken)
Removes all errors asynchronously.
Declaration
public Task RemoveAllAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SetEntryAsync(string, string, string, string, CancellationToken)
Sets a new error log entry asynchronously.
Declaration
public Task SetEntryAsync(string errorMessage, string errorStackTrace = null, string errorUrl = null, string userIdMaster = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | errorMessage | The error message to log. |
string | errorStackTrace | The stack trace of the error (optional). |
string | errorUrl | The URL where the error occurred (optional). |
string | userIdMaster | The Id of the user associated with the error (optional). |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |