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

Nuget.exe push needs a helpful error message for timeout #442

Merged
merged 1 commit into from
Apr 1, 2016

Conversation

spadapet
Copy link
Contributor

NuGet/Home#2199

In each of the command line projects, if "push" times out, then show a better error message. The TaskCanceledException message "A task was canceled." still shows, but then I appended more info about how to change the timeout.

@toddm @emgarten

@toddm
Copy link
Contributor

toddm commented Apr 1, 2016

👍 :shipit:

catch (TaskCanceledException ex)
{
string timeoutMessage = LocalizedResourceManager.GetString(nameof(NuGetResources.PushCommandTimeoutError));
throw new AggregateException(ex, new Exception(timeoutMessage));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect this to throw a more specific exception type. This works because it is just caught and written out to the console?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the console programs catch all exceptions and print out their message as an error. I used AggregateException so that the original TaskCanceledException can be preserved to show its message and optionally its callstack (with verbose output is turned on). And then I combined it with a generic Exception so that a custom message can be displayed.

But if the callstack of the original TaskCanceledException doesn't matter, I can just throw a new specific type of exception here.


In reply to: 58240759 [](ancestors = 58240759)

@emgarten
Copy link
Member

emgarten commented Apr 1, 2016

:shipit:

@spadapet spadapet force-pushed the spadapet/PushTimeoutError branch from 6fc1145 to c2bb129 Compare April 1, 2016 23:44
@spadapet spadapet merged commit c2bb129 into dev Apr 1, 2016
@spadapet spadapet deleted the spadapet/PushTimeoutError branch April 1, 2016 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants