Files
BeWoPlaner/Shared/Core/AppError.cs
Rene Evertz 2832bb9c5e Merge branch 'master' into feature_rene_18_ai - kein kommentar...
# Conflicts:
#	BeWo/BeWo.csproj
#	BeWo/BeWoApp.xaml.cs
#	BeWo/ServiceProxy/GeneratedAiEnhancedService.cs
#	BeWo/Services/BeWoControlFactory.cs
#	BeWo/Services/BeWoWindowFactory.cs
#	BeWo/Services/BeWoWindowService.cs
#	BeWo/Services/IControlFactory.cs
#	BeWo/Services/IWindowFactory.cs
#	BeWo/Services/IWindowService.cs
#	BeWo/View/BeWoFileView.xaml
#	BeWo/View/Detail/Report/AbwesenheitsView.xaml
#	BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs
#	BeWo/app.config
#	BeWoAllReports.sln
#	BeWoPlanerMobil.sln
#	BeWoPlanerMobil/.vs/BeWoPlanerMobil.csproj.dtbcache.json
#	BeWoTests.sln
#	Dakota/DakotaUtils.cs
#	Dakota/Logic/DakotaInfoCreator.cs
#	Dakota/Models/DakotaFile.cs
#	Data/Access/GenericDAO.cs
#	Data/Access/SearchDAO.cs
#	Data/Data.csproj
#	Host/Web.config
#	Server/Components/ServerUtils/ApiFacade/WebClientFacade.cs
#	Service/BeWoServiceEnums.cs
#	Service/Core/ServiceHelper.cs
#	Service/Core/ServiceValidator.cs
#	Service/Extensions/ServiceEnumExtension.cs
#	Service/Service.csproj
#	Service/ServiceContracts/Enhanced/IAiEnhancedService.cs
#	Service/ServiceContracts/Enhanced/IOperationsEnhancedService.cs
#	Service/ServiceImplementations/EmployeeServiceImp.cs
#	Service/ServiceImplementations/Enhanced/AiEnhancedServiceImp.cs
#	Service/ServiceImplementations/Enhanced/OperationsEnhancedServiceImp.cs
#	Service/ServiceProxy/OpenWebUIFacade.cs
#	Service/ServiceProxy/ServiceFacade.cs
#	Service/ServiceUtils/DistanceCalculator/GoogleDistanceMatrixAPI.cs
#	Shared/BeWoEntityEnums.cs
#	Shared/Core/AppError.cs
#	Shared/Core/Facade/WebClientFacade.cs
#	Shared/Core/WebClientFacade.cs
#	Shared/Shared.csproj
2025-11-28 12:07:35 +01:00

64 lines
2.3 KiB
C#

using BS.Shared.DataContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BS.Shared.Core
{
public class AppError
{
public string Code { get; set; }
public string Message { get; set; }
public Dictionary<string, string> Arguments { get; set; }
public List<AppError> InnerErrors { get; set; }
public string Displayname => $"AppError {Code}: {Message}";
// Private damit zentral alle Errors
private AppError(string code, string message, Dictionary<string, string> arguments = null, List<AppError> innerErrors = null)
{
Code = code;
Message = message;
Arguments = arguments;
InnerErrors = innerErrors;
}
public AppError()
{
}
// Muster:
// - public static readonly AppError Example = new AppError("Code", "Message");
// - Usage: var error = AppError.Example;
// Oder mit Abhängigkeit:
// - public static Func<object1, object2, ..., AppError> ExampleFunc = (obj1, obj2, ...) => new AppError(...);
// - Usage: var error = AppError.ExampleFunc(obj1, obj2, ...);
/// <summary>
/// Tenant ist in Anfrage null oder unbekannt
/// </summary>
public static AppError MultitenancyOperationTenantUnknown => new AppError("SERV.HLP.10001", "Tenant unbekannt");
/// <summary>
/// Logger Ordner kann nicht gefunden werden. Hinweis: Web.config
/// </summary>
public static AppError LoggerPathDoNotExist => new AppError("SERV.LOG.10002", "Server falsch konfiguriert");
public static AppError FileNameInvalidChar => new AppError("DATA.LFS.60001", "Fehler beim Speichern");
public static AppError FileNameNotEqFilePath => new AppError("DATA.LFS.60002", "Fehler beim Speichern");
public static AppError StoredFileAlreadyExists => new AppError("DATA.LFS.60003", "Fehler beim Speichern");
public static readonly AppError ApiResponseFailed = new AppError("API.100001", "Api Fehler");
public static readonly AppError JsonParsingError = new AppError("API.100002", "Json Parsing Fehler");
public static readonly Func<Type, AppError> UnsupportedType = (type) => new AppError("BEW.100001", $"Type nicht implementiert: {type}");
public static readonly Func<OrganisationDC, AppError> GkvDatenannahmestelleAdresseNotFound = (dc) => new AppError("GKV.70001", $"Unbekannte Datenannahmestelle. Bitte neu in der Organisation {dc.Name} ermitteln");
}
}