handle stream error