Description
Currently an exception's backtrace is an Array(String)
. This is usually fine, however there are some use cases where you may want to present the trace in a different way; such as pretty printing an exception. Currently this is not very easy to do as each portion of the trace needs to be manually parsed either manually or via an external shard.
I propose that the backtrace is also exposed an a like Array(Frame)
, where each Frame
would have getters for the related info of that line. E.g. filename, method name, line/column etc. This would provide a much cleaner API to work with.
Given Crystal handles printing each line I would assume it inherently has access to each portion of data. This could be kept backwards compatible by exposing the frames as another method that the current one could leverage. E.g. @frames.map &.to_s
.