Fixed the way I was throwing exception.

There is probably a better way to do this.