Getting a 404 error if no license can be obtained from github
McTristan opened this issue · comments
Unhandled exception. System.Net.WebException: The remote server returned an error: (404) Not Found.
Response from https://api.github.com/repos/CharsetDetector/UTF-unknown/license:
{"message":"Not Found","documentation_url":"https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license"}https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license%22%7D
---> System.Net.WebException: The remote server returned an error: (404) Not Found.
at FSharp.Data.HttpHelpers.getResponseAsync@1319-4.Invokemailto:FSharp.Data.HttpHelpers.getResponseAsync@1319-4.Invoke(Exception _arg2)
at <StartupCode$FSharp-Core>.$Async.TryWith@1082-1.Invokemailto:Async.TryWith@1082-1.Invoke(Exception exn) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 1082
at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation1 ctxt, FSharpFunc2 catchFilter, ExceptionDispatchInfo edi) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 436
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc2 firstAction) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 109 --- End of inner exception stack trace --- at FSharp.Data.HttpHelpers.augmentWebExceptionsWithDetails@1227-3.Invoke(Unit unitVar) at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation1 ctxt, TResult result1, FSharpFunc2 part2) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 398 at Microsoft.FSharp.Control.AsyncPrimitives.unitAsync@589.Invoke(AsyncActivation1 ctxt) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 589
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc2 firstAction) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 109 --- End of stack trace from previous location where exception was thrown --- at Microsoft.FSharp.Control.AsyncResult1.Commit() in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 351
at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync1 computation) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 882 at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync1 computation, FSharpOption1 timeout) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 890 at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync1 computation, FSharpOption1 timeout, FSharpOption1 cancellationToken) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 1154
at LicenseCache.checkLicenseViaGitHub$cont@197(String token, String licenseUrl, Group repoGroup, Group orgGroup, Unit unitVar) in /home/vsts/work/1/s/src/DotNetDelice.Licensing/LicenseCache.fs:line 208
at LicenseCache.checkLicenseViaGitHub(String token, String licenseUrl) in /home/vsts/work/1/s/src/DotNetDelice.Licensing/LicenseCache.fs:line 221
at LicenseBuilder.buildLicenseFromPackage$cont@55(Boolean checkGitHub, String token, FSharpFunc2 checkLicenseContents', PackageIdentity identity, LocalPackageInfo pId, LicenseMetadata licenseMetadata, Unit unitVar) in /home/vsts/work/1/s/src/DotNetDelice.Licensing/LicenseBuilder.fs:line 58 at App.getLicenses@44.Invoke(LockFileLibrary lib) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 45 at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 81 at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 68
at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@171.System-Collections-IEnumerator-MoveNextmailto:Microsoft.FSharp.Collections.Internal.IEnumerator.choose@171.System-Collections-IEnumerator-MoveNext() in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 178
at Microsoft.FSharp.Collections.Internal.IEnumerator.next@193[T](FSharpFunc2 f, IEnumerator1 e, FSharpRef1 started, Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 194 at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable1 source)
at Microsoft.FSharp.Collections.SeqModule.SortBy@1105.Invokemailto:Microsoft.FSharp.Collections.SeqModule.SortBy@1105.Invoke(Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 1108
at Microsoft.FSharp.Collections.SeqModule.mkDelayedSeq@469.Invokemailto:Microsoft.FSharp.Collections.SeqModule.mkDelayedSeq@469.Invoke(Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 469
at Microsoft.FSharp.Collections.SeqModule.Length[T](IEnumerable1 source) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 716 at JsonOutput.jsonBuilder(String name, IEnumerable1 licenses) in /home/vsts/work/1/s/src/DotNetDelice/JsonOutput.fs:line 68
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNextmailto:Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 81
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 68 at Microsoft.FSharp.Collections.Generator.Microsoft-FSharp-Collections-Generator-Generator-1-get_Apply@418-1.Invoke(Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 422 at Microsoft.FSharp.Collections.Generator.appG[a](Generator1 g) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 322
at Microsoft.FSharp.Collections.Generator.EnumeratorWrappingLazyGenerator1.System-Collections-IEnumerator-MoveNext() at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer) at JsonOutput.jsonPrinter(String path, IEnumerable1 json) in /home/vsts/work/1/s/src/DotNetDelice/JsonOutput.fs:line 99
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.b__0()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Program.main(String[] args) in /home/vsts/work/1/s/src/DotNetDelice/Program.fs:line 9
The api shows "null" in the license property - see:
https://api.github.com/repos/CharsetDetector/UTF-unknown
It it is trying to load a license via github api which produces a 404 error - would be great to have a way to ignore/allow such errors and/or a fallback solution and or it should not try to load a license if the license-property is null
This should be fixed in 1.5.2 with some actual error handling.
it seems to work, thank you! will do additional checks and look at the result but so far great work!