Skip to content

Commit

Permalink
trace not-found and blacklist warnings as actual warnings, and only o…
Browse files Browse the repository at this point in the history
…nce per query and source combination
  • Loading branch information
viktor-svub committed Jan 18, 2018
1 parent 2bee49e commit 451d5ef
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
15 changes: 13 additions & 2 deletions src/Paket.Core/Dependencies/NuGet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,18 @@ let rec private getPackageDetails alternativeProjectRoot root force (parameters:
traceWarnfn "I/O error for source '%O': %s" source exn.Message
return! trySelectFirst (exn :> exn :: errors) rest
| e ->
traceWarnfn "Source '%O' exception: %O" source e
let mutable information = ""
match e.GetBaseException() with
| :? RequestFailedException as re ->
match re.Info with
| Some requestinfo -> if requestinfo.StatusCode = HttpStatusCode.NotFound then
information <- re.Message
| None -> ignore()
| _ -> ignore()
if information <> "" then
traceWarnIfNotBefore (source, information) "Source '%O' exception: %O" source information
else
traceWarnfn "Source '%O' exception: %O" source e
//let capture = ExceptionDispatchInfo.Capture e
return! trySelectFirst (e :: errors) rest
| [] -> return None, errors
Expand All @@ -301,7 +312,7 @@ let rec private getPackageDetails alternativeProjectRoot root force (parameters:
return! tryV3 nugetSource force
with
| exn ->
eprintfn "Possible Performance degradation, V3 was not working: %s" exn.Message
traceWarnfn "Possible Performance degradation, V3 was not working: %s" exn.Message
if verbose then
printfn "Error while using V3 API: %O" exn

Expand Down
2 changes: 1 addition & 1 deletion src/Paket.Core/Dependencies/NuGetCache.fs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ let tryAndBlacklistUrl doBlackList doWarn (source:NugetSource) (tryAgain : 'a ->
let! (isOk, res) = task |> Async.AwaitTask
if not isOk then
if doWarn then
eprintfn "Possible Performance degradation, blacklist '%s'" url.InstanceUrl
traceWarnIfNotBefore url.InstanceUrl "Possible Performance degradation, blacklist '%s'" url.InstanceUrl
return Choice2Of3 res
else
return Choice1Of3 res
Expand Down
2 changes: 1 addition & 1 deletion src/Paket.Core/Dependencies/NuGetV2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ let tryGetAllVersionsFromNugetODataWithFilter (auth, nugetURL, package:PackageNa
match tryGetAllVersionsFromNugetODataWithFilterWarnings.TryGetValue nugetURL with
| true, true -> ()
| _, _ ->
eprintfn "Possible Performance degradation, could not retrieve '%s', ignoring further warnings for this source" url
traceWarnfn "Possible Performance degradation, could not retrieve '%s', ignoring further warnings for this source" url
tryGetAllVersionsFromNugetODataWithFilterWarnings.TryAdd(nugetURL, true) |> ignore
if verbose then
printfn "Error while retrieving data from '%s': %O" url exn
Expand Down
4 changes: 2 additions & 2 deletions src/Paket.Core/Dependencies/NuGetV3.fs
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,9 @@ let loadFromCacheOrGetDetails (force:bool)
return false,ODataSearchResult.Match cachedObject
with exn ->
if verboseWarnings then
eprintfn "Possible Performance degradation, could not retrieve '%O' from cache: %O" packageName exn
traceWarnfn "Possible Performance degradation, could not retrieve '%O' from cache: %O" packageName exn
else
eprintfn "Possible Performance degradation, could not retrieve '%O' from cache: %s" packageName exn.Message
traceWarnIfNotBefore ("NuGetV3 n/a", packageName, exn.Message) "Possible Performance degradation, could not retrieve '%O' from cache: %s" packageName exn.Message
let! details = getPackageDetails source packageName version
return true,details
else
Expand Down

0 comments on commit 451d5ef

Please sign in to comment.