Fix exception usage

This fixes @stof comment at https://github.com/avalanche123/Imagine/pull/307#discussion_r11486684