Fix exception throwing.
Merge pull request #44 from pal-robotics/master

Fix exception throwing logic.