Closed Tyler-Murphy closed 5 years ago
What would the paths be relative to?
They'd be relative to process.cwd()
, which is the directory the command was run from, assuming the command didn't change directories.
For example, if my current directory is ~/code
, and I run node projectFolder/someFile.js
, and someFile.js
throws an error that's caught and passed through clean-stack
, this new option would cause the path in the stack to be projectName/someFile.js
.
I don't think that is a good idea. That means you need to know from where the code was run to be able to read stack traces. I'm going to pass on this because it's too easily abused. Stack traces are important. Cleaning non-essential information is one thing, but making the paths hard to interpret in certain situations is not something I want to encourage.
Currently, the
pretty
option can be specified to replace the path to the home directory with~
. I think it'd be nice to have an option to show relative paths, so they're even shorter. As-is, the leading part of every path is often identical.This additional check in the step where the path is modified seems to do it, assuming
options.relativePath
istrue
.Would you accept a PR to add this option? Any preferences for the implementation?