code pal for ABAP > Documentation > Empty Catch
This check searches for empty CATCH
blocks.
Perform meaningful exception handling in the CATCH
block.
In exceptional cases, you can suppress this finding by using the pseudo comment "#EC EMPTY_CATCH
or "#EC NO_HANDLER
which should to be placed after the opening statement of the empty CATCH
.
Note that this check is the same as a check in the Extended Program Check (SLIN) delivered by SAP. That check accepts a pragma ##NO_HANDLER
for suppressing its findings that Code Pal cannot evaluate (pragmas are inaccessible to ordinary Code Inspector checks). We recommend that you either use this Code Pal check or the corresponding SLIN check, but not both, since if you use both you get two findings for the exact same issue.
TRY.
"some code
CATCH cx_error. "#EC EMPTY_CATCH
ENDTRY.
CATCH SYSTEM-EXCEPTIONS. "#EC EMPTY_CATCH
ENDCATCH.
TRY.
"some code
CATCH cx_error. "#EC NO_HANDLER
ENDTRY.
CATCH SYSTEM-EXCEPTIONS. "#EC NO_HANDLER
ENDCATCH.