Making sure correct exception is thrown.

Signed-off-by: Ben Corlett <bencorlett@me.com>