Errors should be handled by raising exceptions; see the use of BuildStepFailed just below.