jarhart / rattler

Ruby Tool for Language Recognition
MIT License
44 stars 7 forks source link

Print stack trace on uncaught exception. #4

Open wconrad opened 10 years ago

wconrad commented 10 years ago

This patch causes uncaught exceptions in rtlr to print a stack track to aid in debugging. The meaning of the existing exit codes is preserved.

The code could be made simpler if Runner does not catch Exception, but that would mean rearranging the exit codes, since exit code 1 (which Ruby emits on an uncaught exception) is already used for ERRNO_USAGE. Rearranging the exit codes would be a breaking API change.

Simpler still would be to eliminate the separate error codes, and use use exit code 1 for everything. All of the exception handling in Runner could then be done in one rescue. This would be a more-breaking API change.

jarhart commented 10 years ago

I would say go ahead and change the error codes to make more sense. At this stage I'm more interested in getting it right than avoiding breaking changes, especially for something as peripheral as the shell exit codes.

wconrad commented 10 years ago

The middle option, then, where the separate error codes are maintained, but rearranged?

jarhart commented 10 years ago

I think that's best, yeah.