handeled exception during function defination