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

Move WebException stack trace from User error to verbose log #3062

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

HebaruSan
Copy link
Member

Problem

Download errors look like this currently:

Continue? [Y/n] 

Downloading "https://spacedock.info/mod/1805/Whirligig%20World/download/0.10.0"
System.Net.WebException: The remote server returned an error: (404) NOT FOUND.
  at System.Net.HttpWebRequest.GetResponseFromData (System.Net.WebResponseStream stream, System.Threading.CancellationToken cancellationToken) [0x00146] in <88f564ea69dd4dc8ba9bf979e48d5996>:0 
  at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task`1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func`1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <88f564ea69dd4dc8ba9bf979e48d5996>:0 
  at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00020] in <88f564ea69dd4dc8ba9bf979e48d5996>:0 
  at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request, System.IAsyncResult result) [0x00000] in <88f564ea69dd4dc8ba9bf979e48d5996>:0 
  at System.Net.WebClient.GetWebResponseTaskAsync (System.Net.WebRequest request) [0x0008d] in <88f564ea69dd4dc8ba9bf979e48d5996>:0 
  at System.Net.WebClient.DownloadBitsAsync (System.Net.WebRequest request, System.IO.Stream writeStream, System.ComponentModel.AsyncOperation asyncOp, System.Action`3[T1,T2,T3] completionDelegate) [0x0008d] in <88f564ea69dd4dc8ba9bf979e48d5996>:0 
One or more downloads were unsuccessful:

Error downloading WhirligigWorld 0.10.0: The remote server returned an error: (404) NOT FOUND.

This is scary-looking and redundant; the WebException stack trace does not contain useful information, and we summarize all the errors at the end after that anyway.

All UIs are affected in the same way.

Cause

When an error happens, this line tells NetAsyncModulesDownloader:

onOneCompleted.Invoke(downloads[index].target.url, downloads[index].path, downloads[index].error);

... which then prints the exception with User.RaiseError.

Changes

Now we put that stack trace into log.Info instead, so it won't be visible by default but you can re-enable it with --verbose.

Continue? [Y/n] 

Downloading "https://spacedock.info/mod/1805/Whirligig%20World/download/0.10.0"
One or more downloads were unsuccessful:

Error downloading WhirligigWorld 0.10.0: The remote server returned an error: (404) NOT FOUND.

@HebaruSan HebaruSan added Easy This is easy to fix Core (ckan.dll) Issues affecting the core part of CKAN Pull request Network Issues affecting internet connections of CKAN labels May 28, 2020
@HebaruSan HebaruSan requested a review from DasSkelett May 28, 2020 20:10
@HebaruSan HebaruSan merged commit 72cf8e2 into KSP-CKAN:master Jun 3, 2020
@HebaruSan HebaruSan deleted the fix/dl-err branch June 15, 2020 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core (ckan.dll) Issues affecting the core part of CKAN Easy This is easy to fix Network Issues affecting internet connections of CKAN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants