Throw; or throw E

Source: Internet
Author: User
If an exception is caught, how does one throw it again.
Catch (exception e) {Throw;} or catch (exception e) {Throw E ;}

Throw; the original exception stack information is retained. This facilitates debugging and easily finds the wrong line number.
Throw e will retain the exception information, but it will modify the exception stack information. The row throw e will become an error row, instead of the one you call in try.CodeThe actual error line.
So. Throw should be used to throw an exception again ;.
When will throw E be used?
It seems that you only need to throw a new exception.
Who can make it clear?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.