Files
BeWoPlaner/Shared/Core/AppError.cs
2025-06-10 14:29:34 +02:00

46 lines
1.6 KiB
C#

using BS.Shared.DataContracts;
using BS.Shared.Interface;
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()
{
}
//public static readonly AppError Example = new AppError("Code", "Message");
public static AppError MultitenancyOperationTenantUnknown => new AppError("SERV.HLP.10001", "Tenant unbekannt");
public static AppError LoggerFileDoNotExist => new AppError("SERV.LOG.10001", "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 Func<OrganisationDC, AppError> GkvDatenannahmestelleAdresseNotFound => (dc) => new AppError("GKV.70001", $"Unbekannte Datenannahmestelle. Bitte neu in der Organisation {dc.Name} ermitteln");
}
}