Add type hint to exception when a class selector is used.