The caller should decide how to handle the returned error. In most cases the caller will log the error and exit, but it is also possible to just log a common error and retry. Another possibility is to write the output to a dedicated file, not to STDOUT. The current implementation results at least to duplicate logging.
A good summary of the topic can be found here: Handle Errors Once.