Why does JS have no catchmyexception or similar methods?

Source: Internet
Author: User
In QwrapIn development, you want to implement a chained interrupt function.
That is:
W ('div '). do11 (). do12 (). When (BL). Do21 (). do22 ();
When writing, it is a long chain, but it is expected that if the BL value is false, the subsequent execution will not be executed (or both will be invalid ). Instead of throwing an exception.
However, according to the current JS syntax, it seems difficult to do this.

As a result, I complained about JS exceptions. Why can't I choose to let the current object handle them? Instead, I directly throw them out.
Example: obj. anunknownmethod ();
In this case, an exception occurs because there is no method.
If you can check whether OBJ has oneCatchmyexception (Ex)If yes, call obj. catchmyexception (Ex) first. If not, it is not too late to throw it out.

The advantage is that you must first use obj. catchmyexception to handle exceptions generated by obj. Failed to handle the problem, and then threw it out.

There are no similar features. Sigh ....
Or I cannot find it?

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.