Added error handling to stream example