Validate arguments.

Validate arguments and handle errors.