Correctly handle errors in CMS I/O code.