namespace Lagerbestand.Exceptions; /// /// Base exception for storage location related errors. /// public class StorageLocationException : Exception { public StorageLocationException(string message) : base(message) { } public StorageLocationException(string message, Exception innerException) : base(message, innerException) { } } /// /// Exception thrown when a location code is invalid or malformed. /// public class InvalidLocationCodeException : StorageLocationException { public string? LocationCode { get; } public InvalidLocationCodeException(string locationCode) : base($"Ungültiger Lagerplatz-Code: '{locationCode}'. Das Format muss ABCD sein (z.B. 1101).") { LocationCode = locationCode; } public InvalidLocationCodeException(string locationCode, string reason) : base($"Ungültiger Lagerplatz-Code '{locationCode}': {reason}") { LocationCode = locationCode; } } /// /// Exception thrown when trying to use an occupied location. /// public class LocationOccupiedException : StorageLocationException { public string LocationCode { get; } public Guid? TireStackId { get; } public LocationOccupiedException(string locationCode) : base($"Der Lagerplatz '{locationCode}' ist bereits belegt.") { LocationCode = locationCode; } public LocationOccupiedException(string locationCode, Guid tireStackId) : base($"Der Lagerplatz '{locationCode}' ist bereits mit Reifenstapel belegt.") { LocationCode = locationCode; TireStackId = tireStackId; } } /// /// Exception thrown when a location is not found. /// public class LocationNotFoundException : StorageLocationException { public string? LocationCode { get; } public Guid? LocationId { get; } public LocationNotFoundException(string locationCode) : base($"Lagerplatz '{locationCode}' wurde nicht gefunden.") { LocationCode = locationCode; } public LocationNotFoundException(Guid locationId) : base($"Lagerplatz mit ID '{locationId}' wurde nicht gefunden.") { LocationId = locationId; } } /// /// Exception thrown when a location code already exists. /// public class LocationCodeExistsException : StorageLocationException { public string LocationCode { get; } public LocationCodeExistsException(string locationCode) : base($"Der Lagerplatz-Code '{locationCode}' existiert bereits.") { LocationCode = locationCode; } }