Skip to content

Commit 2fe5819

Browse files
authored
add error handling (#394)
1 parent 4acb646 commit 2fe5819

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

src/z2ui5_cl_demo_app_135.clas.abap

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,27 @@ CLASS z2ui5_cl_demo_app_135 IMPLEMENTATION.
130130

131131

132132
METHOD z2ui5_if_app~main.
133+
TRY.
133134

134-
CLEAR error.
135+
CLEAR error.
135136

136-
IF check_initialized = abap_false.
137-
check_initialized = abap_true.
138-
update_lock_counter( ).
139-
initialize_view( client ).
140-
ENDIF.
137+
IF check_initialized = abap_false.
138+
check_initialized = abap_true.
139+
update_lock_counter( ).
140+
initialize_view( client ).
141+
ENDIF.
141142

142-
TRY.
143-
on_event( client ).
144-
CATCH z2ui5_cx_util_error INTO DATA(x_error).
145-
error-text = x_error->get_text( ).
146-
error-flag = abap_true.
147-
client->view_model_update( ).
148-
ENDTRY.
143+
TRY.
144+
on_event( client ).
145+
CATCH z2ui5_cx_util_error INTO DATA(x_error).
146+
error-text = x_error->get_text( ).
147+
error-flag = abap_true.
148+
client->view_model_update( ).
149+
ENDTRY.
149150

151+
CATCH cx_root INTO DATA(lx).
152+
client->message_box_display( lx->get_text( ) ).
153+
ENDTRY.
150154
ENDMETHOD.
151155

152156

src/z2ui5_cl_demo_app_137.clas.abap

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,18 @@ ENDCLASS.
3030
CLASS z2ui5_cl_demo_app_137 IMPLEMENTATION.
3131

3232
METHOD z2ui5_if_app~main.
33-
IF check_initialized = abap_false.
34-
check_initialized = abap_true.
35-
initialize_view( client ).
36-
ENDIF.
33+
TRY.
34+
35+
IF check_initialized = abap_false.
36+
check_initialized = abap_true.
37+
initialize_view( client ).
38+
ENDIF.
39+
40+
on_event( client ).
3741

38-
on_event( client ).
42+
CATCH cx_root INTO DATA(lx).
43+
client->message_box_display( lx->get_text( ) ).
44+
ENDTRY.
3945
ENDMETHOD.
4046

4147
METHOD initialize_view.

0 commit comments

Comments
 (0)