Fix: avoid notice and incomplete exception when thrown.
Merge pull request #806 from pjezek/fix_avoid_notice_when_trow_an_exception

Fix: avoid notice and incomplete exception when thrown.