Navigation
What an uncaught exception looks like from the user's side - the error popup, and the way back into the app.
Z2UI5_CL_SMP_APP_464
Learn
Navigation
UI5 1.71
The facts
- Repository
- abap2UI5/samples
- Class
Z2UI5_CL_SMP_APP_464- Source file
z2ui5_cl_smp_app_464.clas.abap↗- Category
- Navigation
- Learning path
- Move through the app
- Minimum UI5
- 1.71 — the floor abap2UI5 holds its samples to
- In the playground
- runs in the browser, with no system and nothing installed
- Documentation
- abap2ui5.github.io/docs/cookbook/event_navigation/exception ↗
Keywords: exception, dump, error, handling, debugtool, restart, retry
Controls it builds
Read out of the builder chain by the abap2UI5 linter, not from the category this sample is filed under — which is what makes “which samples build one of these” a question the catalogue can answer at all.
Libraries
Run it here
The sample running, in this page — the app on its own, with no editor over it.
Switch to Playground with this code
Nothing is installed and nothing is sent anywhere: the ABAP is compiled to JavaScript in this browser and runs against abap2UI5 itself.
The ABAP
z2ui5_cl_smp_app_464.clas.abap — 92 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords exception dump error handling debugtool restart retry
" @summary What an uncaught exception looks like from the user's side - the error popup, and the way back into the app.
" @docs https://abap2ui5.github.io/docs/cookbook/event_navigation/exception
CLASS z2ui5_cl_smp_app_464 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smp_app_464 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_navigated( ).
view_display( ).
ELSE.
on_event( ).
ENDIF.
ENDMETHOD.
METHOD on_event.
CASE client->get_event( ).
WHEN `RAISE_EXCEPTION`.
" the division dumps - nothing ever reads the result, and that is
" the point of the sample
DATA(lv_zero) = 0.
DATA(lv_result) = 1 / lv_zero ##NEEDED.
WHEN `ASSERT`.
ASSERT 1 = 0.
ENDCASE.
ENDMETHOD.
METHOD view_display.
DATA(view) = z2ui5_cl_ui5_view_builder=>factory(
)->ele( n = `View` ns = `mvc`
)->a( n = `displayBlock` v = `true`
)->a( n = `height` v = `100%`
)->a( n = `xmlns` v = `sap.m`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns:core` v = `sap.ui.core` ).
DATA(page) = view->ele( `Shell`
)->ele( `Page`
)->a( n = `title` v = `abap2UI5 - Navigation - Uncaught Error and Error Popup`
)->a( n = `showNavButton` b = client->check_app_prev_stack( )
)->a( n = `navButtonPress` v = client->_event_nav_app_leave( ) ).
page->tag( `MessageStrip`
)->a( n = `text` v = `Trigger an unexpected error. The client shows a popup "An unexpected error ` &&
`occurred" with two buttons: Details jumps into the DebugTool's Error tab (full ` &&
`error text plus Retry/Refresh/Logout), Restart reloads the app. Open the ` &&
`DebugTool any time with Ctrl+F12.`
)->a( n = `type` v = `Warning`
)->a( n = `showIcon` b = abap_true
)->a( n = `class` v = `sapUiSmallMargin` ).
page->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Button`
)->a( n = `press` v = client->_event( `RAISE_EXCEPTION` )
)->a( n = `text` v = `Raise an exception`
)->a( n = `icon` v = `sap-icon://error`
)->a( n = `type` v = `Reject`
)->tag( `Button`
)->a( n = `press` v = client->_event( `ASSERT` )
)->a( n = `text` v = `Trigger an Assert Error / Dump`
)->a( n = `icon` v = `sap-icon://alert`
)->a( n = `class` v = `sapUiTinyMarginTop` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
ENDCLASS.
More in Navigation
- Navigation — Call and Leave Apps (nav_app_call)
- Navigation — Data Loss Protection on Leaving (A,C)
- Navigation — Return Data and Events to the Caller
On this page