cpp: add throw declaration to exceptions