Test throwing of an exception