Skip to content

Preserve the Original Exception with PREVIOUS ​

WarningAnti-Patterns & Bad Practices#EC NO_EXC_CHAINRemote Enabled

Overview ​

Preserve the original exception with PREVIOUS.

ATC Finding Message: Converted exception does not follow the PREVIOUS chaining policy

Rationale ​

When a handler converts an exception into a new one without setting previous, the caller loses the root cause and only sees the outer symptom. Passing the caught exception object through the previous attribute keeps the full chain available in the stack trace and in RAP error logs. The rule inspects RAISE EXCEPTION NEW and RAISE EXCEPTION TYPE inside CATCH ... INTO handlers.

Non-Compliant ​

abap
TRY.
    lo_http->send( ).
  CATCH cx_http_error INTO lx_http.
    RAISE EXCEPTION NEW zcx_upload_failed( ).
ENDTRY.

Compliant ​

abap
TRY.
    lo_http->send( ).
  CATCH cx_http_error INTO lx_http.
    RAISE EXCEPTION NEW zcx_upload_failed( previous = lx_http ).
ENDTRY.

Configuration & Thresholds ​

This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:

Parameter NameData TypeDefault ValueDescription & Guidance
REQUIRE_PREVIOUSBooleantrueReport converted exceptions without PREVIOUS (default); disable to report the opposite style

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.