Add error handling to the stream functions