Sublime Forum

Error Highlighting With Ruby begin/rescue Blocks

#1

I’ve got a begin/rescue block in a unit test. Within the begin block, the test deliberately makes an invalid call to a method. This gets picked up by the rescue block where the error is checked to make sure the right error has been thrown. Standard stuff that all works as expected. The test framework reports a 100% success rate.

The issue is that ST3 is placing an error highlight under the line that is throwing the deliberate error. I suppose this is technically correct. But this behavior is causing a fair amount of confusion amongst the team: ST3 is indicating that errors have occurred but the test framework is saying everything is fine.

I’m guessing that ST3 places the error highlighting by parsing the output of the Ruby compiler while looking for certain error-related strings. If it finds than an error has occurred, there’s no easy way for it to know if an error has been handled or not; it will just put a highlight on every line within the call stack leading up to that error.

I know that the error highlighting can be turned off, but it is often a handy thing to have. I’d just like some confirmation that ST3 has some sort bug/quirk when it comes to flagging errors within a begin/catch block. On the other hand, if I’m completely wrong about all this, feel free to tell me that as well :confounded:. Thanks for your time.

0 Likes