Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DependenciesFileParser now tracks inner exceptions for package sources #1987

Merged
merged 1 commit into from
Oct 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Paket.Core/DependenciesFileParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,13 @@ module DependenciesFileParser =

match trimmed with
| _ when String.IsNullOrWhiteSpace line -> Empty(line)
| String.StartsWith "source" _ as trimmed -> Remote(RemoteParserOption.PackageSource(PackageSource.Parse(trimmed)))
| String.StartsWith "source" _ as trimmed ->
try
let source = PackageSource.Parse(trimmed)
Remote(RemoteParserOption.PackageSource(source))
with e ->
traceWarnfn "could not parse package source %s (%s)" trimmed e.Message
reraise ()
| String.StartsWith "cache" _ as trimmed -> Remote(RemoteParserOption.Cache(Cache.Parse(trimmed)))
| String.StartsWith "group" _ as trimmed -> Group(trimmed.Replace("group ",""))
| String.StartsWith "nuget" trimmed ->
Expand Down
6 changes: 3 additions & 3 deletions src/Paket.Core/Domain.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ let GroupName(name:string) =
type DomainMessage =
| DirectoryDoesntExist of DirectoryInfo
| DependenciesFileNotFoundInDir of DirectoryInfo
| DependenciesFileParseError of FileInfo
| DependenciesFileParseError of FileInfo * exn
| LockFileNotFound of DirectoryInfo
| LockFileParseError of FileInfo
| ReferencesFileParseError of FileInfo
Expand Down Expand Up @@ -127,8 +127,8 @@ type DomainMessage =
sprintf "Directory %s does not exist." di.FullName
| DependenciesFileNotFoundInDir(di) ->
sprintf "Dependencies file not found in %s." di.FullName
| DependenciesFileParseError(fi) ->
sprintf "Unable to parse %s." fi.FullName
| DependenciesFileParseError(fi,e) ->
sprintf "Unable to parse %s. (%s)" fi.FullName e.Message
| LockFileNotFound(di) ->
sprintf "Lock file not found in %s. Create lock file by running paket install." di.FullName
| LockFileParseError(fi) ->
Expand Down
4 changes: 2 additions & 2 deletions src/Paket.Core/Environment.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ module PaketEnv =
else
try
ok (DependenciesFile.ReadFromFile(fi.FullName))
with _ ->
fail (DependenciesFileParseError fi)
with e ->
DependenciesFileParseError(fi,e) |> fail

let! lockFile =
let fi = FileInfo(Path.Combine(directory.FullName, Constants.LockFileName))
Expand Down
2 changes: 1 addition & 1 deletion src/Paket.Core/NugetConvert.fs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ let createDependenciesFileR (rootDirectory : DirectoryInfo) nugetEnv mode =
try
DependenciesFile.ReadFromFile dependenciesFileName
|> ok
with _ -> DependenciesFileParseError (FileInfo dependenciesFileName) |> fail
with e -> DependenciesFileParseError (FileInfo dependenciesFileName, e) |> fail
|> lift addPackages

let create() =
Expand Down
2 changes: 1 addition & 1 deletion src/Paket.Core/Paket.Core.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
<Compile Include="Async.fs" />
<Compile Include="AssemblyInfo.fs" />
<Compile Include="CustomAssemblyInfo.fs" />
<Compile Include="Domain.fs" />
<Compile Include="Logging.fsi" />
<Compile Include="Domain.fs" />
<Compile Include="Logging.fs" />
<Compile Include="Constants.fs" />
<Compile Include="Utils.fs" />
Expand Down