Bugfix: emit errors correctly for streaming apis.
Merge pull request #37 from nlf/streaming_error_bugfix

Bugfix: emit errors correctly for streaming apis.