Refactor argument validation error handliing.