Improves error handling by defining custom errors for more informative messaging for users.
3 custom errors have been defined: InputError, CSVError and Other. These errors would catch incorrect arguments, errors in CSV parsing and other situations, respectively. None of the code is consuming the Other error type currently, but it is there for future utilization if we need it.
The InputError now prints this to stdout:
Error: InputError(Custom { kind: InvalidInput, error: "Invalid argument was entered. Please try again." })
Tests:
Build passes
Clone this branch locally. Invoke the CLI with an incorrect argument (such as reg instead of register) and note that the error message is bit more helpful.
Fixes:
InputError
,CSVError
andOther
. These errors would catch incorrect arguments, errors in CSV parsing and other situations, respectively. None of the code is consuming theOther
error type currently, but it is there for future utilization if we need it.InputError
now prints this tostdout
:Error: InputError(Custom { kind: InvalidInput, error: "Invalid argument was entered. Please try again." })
Tests:
reg
instead ofregister
) and note that the error message is bit more helpful.