Added a CHECK for errors. Similar to the checkException of the RUnit package