Previous implementation fails as `resolver.get_identifier_def` in ARTIQ
would return the exception __init__ function rather than the class.
We fix this by limiting the exception class resolution to only include
raise statements, and to force the exception name to always be treated
as a class.
Fixes#501.