Skip to content

Avoid Catching Generic CX_ROOT ​

WarningSecurity & Robustness#EC CATCH_ROOTRemote Enabled

Overview ​

Catch specific exceptions instead of generic cx_root.

ATC Finding Message: Avoid generic CATCH cx_root; catch specific exception classes instead

Rationale ​

Catching CX_ROOT catches programming errors, resource shortages, and runtime failures together with expected business exceptions. The handler cannot respond correctly to all of them and may hide serious defects. Catch only the specific exception types you can handle and let everything else propagate.

Non-Compliant ​

abap
TRY.
  process_order( ).
CATCH cx_root.
  " swallowed
ENDTRY.

Compliant ​

abap
TRY.
  process_order( ).
CATCH cx_order_failed INTO DATA(lx_order).
  logger->record( lx_order ).
ENDTRY.

Suppression ​

To suppress findings for this rule, append the pseudo-comment to the statement:

abap
" Standard pseudo-comment:
... "#EC CATCH_ROOT

" SAP CI_ prefix format:
... "#EC CI_CATCH_ROOT

Technical Details ​

Released under the MIT License.