From 2108f59ea77b7e9500037165990f8767de5c3ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sat, 29 Jan 2022 19:08:48 +0100 Subject: [PATCH] feat(data): return correct message with file not found in archive --- Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs b/Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs index 58090b9..1590fbf 100644 --- a/Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs +++ b/Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs @@ -19,12 +19,13 @@ public record FileArchive(IReadOnlyList Files) /// /// The name of the file. /// A file or an error. - public Result Search(string name) + public Result FindFile(string name) { - var foundFile = Files.OfType().FirstOrDefault(x => Path.GetFileName((RawFile)x.Path) == name, null); + var foundFile = Files.OfType().FirstOrDefault + (x => Path.GetFileName(((RawFile)x!).Path) == name, null); if (foundFile is null) { - return new NotFoundError(); + return new NotFoundError($"Could not find file {name} in archive."); } return (RawFile)foundFile; -- 2.48.1