refactor: Entfernte die HandleException Methode aus der CRUDService Klasse und dem Interface

- Die Methode `HandleException` wurde aus der `CRUDService` Klasse entfernt.
- Die Methode wurde ebenfalls aus dem `ICRUDService` Interface entfernt.
This commit is contained in:
Developer 02 2024-09-11 10:05:15 +02:00
parent c6199cc0be
commit a6d554fbc2
2 changed files with 0 additions and 21 deletions

View File

@ -45,16 +45,5 @@ namespace DigitalData.Core.Abstractions.Application
/// <param name="id">The identifier of the entity to check.</param> /// <param name="id">The identifier of the entity to check.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the entity exists.</returns> /// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the entity exists.</returns>
Task<bool> HasEntity(TId id); Task<bool> HasEntity(TId id);
/// <summary>
/// Handles exceptions that occur within service actions. This method should log the exception
/// and return an String that contains information about the error, which can then be sent to the client.
/// The implementation should determine the appropriate level of detail to include in the error message
/// based on security and usability considerations.
/// </summary>
/// <param name="ex">The exception that occurred during the controller action.</param>
/// <returns>An string instance representing the outcome of the error handling process.
/// This includes a flag indicating the operation was unsuccessful and any relevant error messages.</returns>
string HandleException(Exception ex);
} }
} }

View File

@ -113,15 +113,5 @@ namespace DigitalData.Core.Application
var entity = await _repository.ReadByIdAsync(id); var entity = await _repository.ReadByIdAsync(id);
return entity is not null; return entity is not null;
} }
/// <summary>
/// Handles exceptions that occur during CRUD operations, providing a structured string.
/// </summary>
/// <param name="ex">The exception that was caught during CRUD operations.</param>
/// <returns>A <see cref="IServiceMessage"/> containing information about the failure, including a user-friendly error message and additional error details.</returns>
public virtual string HandleException(Exception ex)
{
return $"An unexpected error occurred on the server side. Please inform the IT support team.\n{ex.GetType().Name}\n{ex.Message}";
}
} }
} }