Extract common invalid raises into method