-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
An admin must run tests on this PR before it can be merged. |
@@ -496,7 +496,7 @@ class View extends Template | |||
|
|||
5.16. If a method uses system resources (such as files, sockets, streams, etc.), the code MUST be wrapped with a `try` block and the corresponding `finally` block. In the `finally` sections, all resources SHOULD be properly released. | |||
|
|||
5.17. `LocalizedException` SHOULD only be thrown in the Presentation layer (Controllers, Blocks). | |||
5.17. Exceptions which need to be displayed to the user MUST be sub-types of `LocalizedException`. Any other types of exceptions MUST be wrapped with `LocalizedException` before being displayed to the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also want to use LocalizedException only in presentation layer, after change it's not clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use it in service contracts, which are directly exposed as web API, what is the alternative proposal for service contracts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can convert service contract exceptions to LocalizedException before displaying to the user. Can we keep somehow part that LocalizedException should be only be thrown in presentation layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will be the conversion rule? We have a hierarchy of LocalizedException classes. Where will the translation be done?
Also this will be backward incompatible change to @api since most service contracts have LocalizedException declared via @throws
running tests |
Hi @paliarush, thank you for your contribution! |
@dobooth please add |
This PR is a:
Summary
When this pull request is merged, it will...
whatsnew
Updated definition of Exceptions 5.17.