[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

.Net exception for System.Net.WebClient

Posted on 2013-11-29
1
Medium Priority
?
618 Views
Last Modified: 2013-11-29
I want to test if my codes can catch as many possible exception as it can in try-catch block.
In order to do that, I need to know what is the list of exceptions can be raised by using a particular class.
For example, when I use System.Net.Webclient, what exceptions can be raised? in MSDN, I can find any list of possible exceptions for a specific class I use.
In more specific, when I create an object system.net.webclient, what excpetions are thrown with the constructor?
And when I use methods of the class, what exceptions are thrown?
How do I know what list of exceptions can be thrown for constructor and methods?
0
Comment
Question by:crcsupport
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 39685964
Hi crcsupport;

Microsoft documents each exception that can be thrown by methods of a class. To see these exceptions goto the documentation and see the section in the method called Exceptions. For example if you what to know what exceptions the function WebClient.OpenRead(Uri) goto your browser and make a search on, WebClient.OpenRead .Net MSDN, note that I placed .Net MSDN at the end, I found out by doing this what I am looking for on the Microsoft site always is shown first or within the first couple of lines. So when I placed WebClient.OpenRead .Net MSDN in Google search bar in the result it was the second on the list. When I followed the link I looked for the section on Exceptions and found that it is programed to throw two types of exceptions, ArgumentNullException and WebException. Now that does not mean that while that methods is being executed it will not throw some other types of exception which is from the code that you have placed there so you need to be aware of what other exception can be thrown from that code by looking it up as well.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question