From 7b4aa7d8088cc4b74b0b7588bb7b429981181c41 Mon Sep 17 00:00:00 2001 From: Max Malook Date: Sat, 29 Nov 2014 00:23:07 +0100 Subject: [PATCH] fail with better error message when file to reference not present in lock file --- src/Paket.Core/InstallProcess.fs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Paket.Core/InstallProcess.fs b/src/Paket.Core/InstallProcess.fs index f8195ec873..4cebfcdd6f 100644 --- a/src/Paket.Core/InstallProcess.fs +++ b/src/Paket.Core/InstallProcess.fs @@ -152,7 +152,10 @@ let Install(sources,force, hard, lockFile:LockFile) = let getSingleRemoteFilePath name = tracefn "Filename %s " name lockFile.SourceFiles |> List.iter (fun i -> tracefn " %s %s " i.Name i.FilePath) - (lockFile.SourceFiles |> List.find (fun f -> Path.GetFileName(f.Name) = name)).FilePath + let sourceFile = lockFile.SourceFiles |> List.tryFind (fun f -> Path.GetFileName(f.Name) = name) + match sourceFile with + | Some file -> file.FilePath + | None -> failwithf "%s references file %s, but it was not found in the paket.lock file." referenceFile.FileName name let gitRemoteItems = referenceFile.RemoteFiles