Under some circunstamces, when there is an error in a portlet, the user is redirected to a new blank page with the message: X is temporarily unavailable
It would be nicer if the portlet would handle that error in the same way it handles most errors keeping the user in the same UI where she is just pointing that something unexpected happened.
Steps to test the Story:
- Add a new page
- As the name, use the ghost emoji. (Copy it from this page, JIRA doesn't support it either: https://www.emojibase.com/emoji/1f47b/ghost )
- Save --> This will take you to a blank page with the text: "Layouts Admin is temporarily unavailable".
Expected behaviour: The user is kept in the form for adding a page and she is shown an error message.
- This all started in the conversation from: https://github.com/juliocamarero/liferay-portal/pull/4246
It seems all portlets are already able to handle any exception, not only the Layouts Admin Portlet.
These are the key parts of the code related to this:
- LiferayPortlet.java;processAction --> Only the exceptions checked by the isSessionErrorException are introduced as a SessionError, the rest are thrown and captured later by the render_portlet.jsp (see variable portletException that captures any exception and renders the portlet_error.jsp, which prints the message X is temporarily unavailable)
- portlet_content_wrapper.jspf --> <liferay-theme:portlet-messages --> page.jsp contains in the bottom this taglib that will print a generic error message for any exception added to SessionErrors <liferay-ui:error />
Therefore, it seems we could have every portlet to always print their error messages using this mechanism instead of showing the generic error.