code pal for ABAP > CX_ROOT Usage Check
This check searches for direct "CX_ROOT" exceptions being used in the code (e.g.: In a TRY-CATCH block).
It search for the "direct" usage of CX_ROOT exceptions like:
Explicitly:
TRY.
cls=>meth( ).
CATCH cx_root.
cl_demo_output=>display( 'Catching exception' ).
ENDTRY.
Implicitly:
CLASS cx_my_exception DEFINITION INHERITING FROM cx_root.
ENDCLASS.
The solution is to use well defined and specific class-based exceptions.
In exceptional cases, you can suppress this finding by using the pseudo comment “#EC NEED_CX_ROOT
which should be placed after the CATCH statement:
TRY.
cls=>meth( ).
CATCH cx_root. "#EC NEED_CX_ROOT
cl_demo_output=>display( 'Catching exception' ).
ENDTRY.