throw correct exception