Added on_error() in streaming