AriaMinaei/pretty-error

Feature request: Reverse stack trace / message location

aight8 opened this issue · 1 comments

Stack traces are in generall have a not-ideal representation for CLI. If the stack is longer the message and the first trace item is at the beginning of the stack output.
It would be nice if there were an option to reverse the output.

item 3
item 2
item 1

Error: The error message


This is lot easier to read, try it out!

Also I show a code frame (using babel code frame) of the last trace item. The problem currently is that the code frame represents the first entry, and the first entry, which stands at the first position of the list.

So there should be 2 options:

  • reverseStackTrace
  • showErrorOnBottom

Hi @aight8,

I quite like the ideas you proposed in this issue and others (#45, #44, #43, #42). Implementing them shouldn't be too complicated, so I'd be happy to help you if you wanted to do them yourself and submit PRs. You can get started by running the test suite in debug mode to see how the whole thing works from start to finish.