Why getattr() here instead of `self.stream.error.__class__(message)`?  For that matter, why not simply `raise self.stream.error`?

Please run the tests before submitting a pull request - it looks like this has broken something according to travis-ci.  It would also be good to add a test for this behavior to ensure that the correct exception type is raised.