Difference between exception and httpexception


What is the difference between the following:

Throw New Exception("test")
Throw new httpException("test")

Is there any difference in output to the stacktrace/exception details and such?
LVL 13
Who is Participating?
DhaestConnect With a Mentor Commented:
As far as I see it, it's easier to know what the reason of the exception is. If you always catch the general exception, you can't do anything with it.
While if you know for example that you can get a System.IO.IOException you can inform the user that there was an error with the file that he wanted to read, write, ... and let the program continue. Whenever another exception occurs, you really want to quit the program
The HttpException class is an HTTP-specific exception class that enables ASP.NET to generate exception information. For more information about throwing and handling exceptions, see Handling and Throwing Exceptions.

I don't think that there will be a difference in the stacktrace details
OnthraxAuthor Commented:
I have read (most parts) of the article.

As far as I can tell the httpexception has the exception base class. But what is the added value of the httpexception in regard to the exception class?
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

It's better to catch the correct exceptions instead of the general exception (see the part of exception handling)
OnthraxAuthor Commented:
I'm sure it is.. but I can't seem to find what the added value of the httpexception is. I would like to know this.
OnthraxAuthor Commented:
You got a point there. I think I'll leave it at that. Thank you for the insight.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.