From a6d554fbc2f97cfbd4cbf812727e9a0ec465b3dc Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 11 Sep 2024 10:05:15 +0200 Subject: [PATCH] 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. --- .../Application/ICRUDService.cs | 11 ----------- DigitalData.Core.Application/CRUDService.cs | 10 ---------- 2 files changed, 21 deletions(-) diff --git a/DigitalData.Core.Abstractions/Application/ICRUDService.cs b/DigitalData.Core.Abstractions/Application/ICRUDService.cs index 2c6074d..0b07300 100644 --- a/DigitalData.Core.Abstractions/Application/ICRUDService.cs +++ b/DigitalData.Core.Abstractions/Application/ICRUDService.cs @@ -45,16 +45,5 @@ namespace DigitalData.Core.Abstractions.Application /// The identifier of the entity to check. /// A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the entity exists. Task HasEntity(TId id); - - /// - /// 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. - /// - /// The exception that occurred during the controller action. - /// 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. - string HandleException(Exception ex); } } \ No newline at end of file diff --git a/DigitalData.Core.Application/CRUDService.cs b/DigitalData.Core.Application/CRUDService.cs index daadf67..76944b8 100644 --- a/DigitalData.Core.Application/CRUDService.cs +++ b/DigitalData.Core.Application/CRUDService.cs @@ -113,15 +113,5 @@ namespace DigitalData.Core.Application var entity = await _repository.ReadByIdAsync(id); return entity is not null; } - - /// - /// Handles exceptions that occur during CRUD operations, providing a structured string. - /// - /// The exception that was caught during CRUD operations. - /// A containing information about the failure, including a user-friendly error message and additional error details. - 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}"; - } } } \ No newline at end of file