decred / politeia

ISC License
110 stars 75 forks source link

pivoter: Cosolidate config error reporting. #1648

Closed davecgh closed 2 years ago

davecgh commented 2 years ago

This modifies the initial configuration error handling logic to mirror more recent logic from dcrd to avoid a bunch of duplicate code and fix some cases that were not logging the errors as expected.

It accomplishes this by consolidating the error reporting in a single place in the caller and introducing a custom error type which signals that the usage message should be suppressed in order to retain the primary behavior the originally was the reason for the prints being in the config function to begin with.

The application name is passed into the function now since it is needed in both places.

Finally, this also corrects a couple of other issues such as the log rotator not being properly closed and a panic when trying to get help without specifying a command.