add error handler to stream api