Can the mvc model layer not throw an exception ??

Source: Internet
Author: User
Can the mvc model layer not throw an exception ?? Someone said to me, "the design model layer for mvc should not perform any errors or other operations. These operations should be completed by c. "

Is that true? Why can't I throw an exception on the M layer? I cannot understand


Reply to discussion (solution)

There are no rules for this.

However, he also said that the model is the business logic. if the model is abnormal, the entire process will be wrong.
Of course, he said: When the model encounters an exception, it only throws and does not handle it. Process to Controller

The control layer calls the model business logic return value and throws an exception accordingly.

This is absolutely true. There is no standard for such things. The M layer can also throw an exception.

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.