Back

LL042

Raise with variable in except

Object Pascal — Delphi & Free Pascal
Warning
Reliability

Re-raising the caught exception variable resets the stack trace, losing diagnostic information

re-raising the caught exception variable resets the stack trace, losing diagnostic information.

Why this severity

re-raising the caught exception variable resets the stack trace, losing diagnostic information.


Known false positives

intentional re-wrap scenarios where a new exception is constructed.

Remediation example

except
  on E: Exception do
  begin
    LogError(E);
    raise; // preserves original stack trace
  end;
end;

Reconnecting… Connection lost. Reload