decred / dcrpool

decred mining pool
ISC License
31 stars 28 forks source link

config: Consolidate error reporting. #352

Closed davecgh closed 1 year ago

davecgh commented 1 year ago

This requires #351.

This modifies the initial configuration error handling logic to match dcrd. In particular, the logic is modified 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.

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