added exceptions to cpp classes