Exceptions in models #35827
Unanswered
dmitriitux
asked this question in
General
Replies: 1 comment
-
Hi, maybe this can be similar problem to this one: #35811 Empty data should be not handled as exception or error. You never know who asks for them and if some part of system just asks for check if there is some data or not, it does not get any answer but exception which cannot be managed anyway :-( Jan |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/joomla/joomla-cms/blob/4.0-dev/components/com_content/src/Model/ArticleModel.php#L222
Please explain why you are adding exceptions to the models? Why don't they just return empty data and that's it, why do they need exceptions here? The model should not drop into an exception and 404 error. It only has to work with data, not crash the program. For example, we use models in our extensions, but it turns out that we need to hang around with try / catch everywhere with them, and not just get empty data and let the model decide from where it was called from, what to do next.
Beta Was this translation helpful? Give feedback.
All reactions