Closed jswinarton closed 5 years ago
Thanks @jswinarton, good catch :+1:
It should be raising the defined BlackbirdSyntaxError
, but I was trying to be a bit too clever and replace the default python traceback, leading to the error handler wrapping the custom exceptions in calls to sys.exit()
.
See here for the problematic code section:
I'll remove this behavior in a PR.
Fixed via #16
Calls to
blackbird.load
orblackbird.loads
that pass in a malformed Blackbird script raise aSystemExit
error. This is a problem becauseSystemExit
is a special error class that causes the Python program to quit, which can have unintended consequences. For example, runningblackbird.loads('invalid script')
in a python REPL causes the REPL to quit, whereas other exception classes print the traceback and allow the user to continue. This could have other unintentional effects when used with other software.The ideal solution would be to define a base
BlackbirdException
class that all blackbird errors inherit from, and then define aBlackbirdParseError
that derives fromBlackbirdException
.