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

Transport Timeout Errors #9

Open
SamHurne opened this issue Sep 19, 2015 · 0 comments
Open

Transport Timeout Errors #9

SamHurne opened this issue Sep 19, 2015 · 0 comments
Milestone

Comments

@SamHurne
Copy link
Collaborator

[Moved from Codeplex: https://gw2dotnet.codeplex.com/workitem/1216]

When a timeout occurs, the default behavior is to throw a System.Net.WebException. Would it make sense to throw a System.TimeoutException instead? Timeouts are not as extreme as most other transport errors, and are usually caused by network congestion instead of a bad network configuration.

Ruhrpottpatriot wrote Aug 10, 2014 at 8:10 AM

I think it'd be best to throw a WebException with a TimeoutException being the inner exception

StevenLiekens wrote Aug 10, 2014 at 9:05 AM

We can't throw a new WebException and also preserve the original exception details that were generated by the framework. But we can catch the source WebException and wrap it in a new TimeoutException. So client code would look like this:

try
{
   // Talk to the service service.GetBuild();
} 
catch (ServiceException ex)
{ 
   // Handle errors generated by the server
}
catch (TimeoutException ex)
{ 
   // Handle timeouts
}
catch (WebException ex)
{
   // Handle fatal errors
}
@Ruhrpottpatriot Ruhrpottpatriot added this to the v1.3.0 milestone Oct 3, 2015
@sliekens sliekens modified the milestones: v2.0.0, v1.3.0 Oct 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants