Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#19894 closed enhancement (fixed)

print message when no module is activated

Reported by: iwakeh Owned by: iwakeh
Priority: Medium Milestone: CollecTor 1.0.2
Component: Metrics/CollecTor Version:
Severity: Minor Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


When no module is activated CollecTor just runs and does nothing.

Suggested behavior:
print information and usage and exit if no module is activated.

Child Tickets

Change History (6)

comment:1 Changed 4 years ago by iwakeh

Status: newneeds_review

Please review this commit.

comment:2 Changed 4 years ago by karsten

Hmm, is there a way to avoid printing the stack trace and instead print just the error message and exit? I could imagine that many new users would run into that case and conclude from the stack trace that the code is broken. Example:

$ java -jar collector-1.1.0-dev.jar 
Could not find config file. In the default configuration, we are not configured to read data from any data source or write data to any data sink. You need to change the configuration ( and provide at least one data source and one data sink. Refer to the manual for more information.
java -jar collector.jar [path/to/configFile]
$ java -jar collector-1.1.0-dev.jar 
Exception in thread "main" org.torproject.collector.conf.ConfigurationException: Nothing is activated!
Please edit Exiting.
	at org.torproject.collector.conf.Configuration.anythingActivated(
	at org.torproject.collector.conf.Configuration.setWatchableSourceAndLoad(
	at org.torproject.collector.Main.main(

comment:3 Changed 4 years ago by iwakeh

Very good point!

The main method now catches all ConfigurationExceptions and only prints the exception's message and usage. This should be fine as ConfigurationExceptions can be handled by user intervention.

Please review the latest commit.

comment:4 Changed 4 years ago by karsten

Status: needs_reviewmerge_ready

Looks good, will merge together with #19895!

comment:5 Changed 4 years ago by karsten

Resolution: fixed
Status: merge_readyclosed

Merged together with #19895. Closing. Thanks!

comment:6 Changed 4 years ago by iwakeh

Milestone: CollecTor 1.1.0CollecTor 1.0.2

Added to appropriate milestone.

Note: See TracTickets for help on using tickets.