In ex-info, avoid recording stack frames of ex-info itself

Description

ex-info is a function to construct ExceptionInfo instances. However, the construction captures the stack frames of calling ex-info, which are not what the caller intends to transmit. As a result, ex-info always has top stack frames that are about constructing the exception rather than the stack that is throwing:

Proposed: Have ex-info construct the exception, but remove the ex-info stack frames. All callers then see the intended stack trace.

Patch: clj-2386-2.patch

Screener Questions:

  1. elide-class-frames will turn a nil stack trace into an empty stack trace array. I don't think ex-info can ever have a nil stack trace, so maybe it doesn't matter. (Alex: Java stack traces can be removed by the JVM. Changed code to not change nil stack.)

  2. the elision is about both leading and class, and "class" is already known via the argument name, so maybe elide-leading-frames is a better name? (Alex: "leading" is ambiguous but changed to "elide-top-frames" which maybe is clearer?)

Environment

None
Completed

Assignee

Unassigned

Reporter

Alex Miller

Labels

Approval

Ok

Patch

Code

Fix versions

Priority

Major
Configure