Throw the correct exception