Skip to content

Commit 22846c9

Browse files
committed
bug: cleaner error message on OptionUnsetError in initialize
We got a scary traceback when a: roundup.configuration.OptionUnsetError exception was raised during tracker.init(). Capture the exception and raise a UsageError that is printed more cleanly. It now reads: Error: In tracker/config.ini - MAIL_DOMAIN is not set and has no default
1 parent f2d2492 commit 22846c9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

roundup/admin.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from roundup import date, hyperdb, init, password, token
3636
from roundup import __version__ as roundup_version
3737
import roundup.instance
38-
from roundup.configuration import (CoreConfig, NoConfigError,
38+
from roundup.configuration import (CoreConfig, NoConfigError, OptionUnsetError,
3939
ParsingOptionError, UserConfig)
4040
from roundup.i18n import _, get_translation
4141
from roundup.exceptions import UsageError
@@ -616,8 +616,12 @@ def do_initialise(self, tracker_home, args):
616616
tracker.nuke()
617617

618618
# GO
619-
tracker.init(password.Password(adminpw, config=tracker.config),
620-
tx_Source='cli')
619+
try:
620+
tracker.init(password.Password(adminpw, config=tracker.config),
621+
tx_Source='cli')
622+
except OptionUnsetError as e:
623+
raise UsageError("In %(tracker_home)s/config.ini - %(error)s" % {
624+
'error': str(e), 'tracker_home': tracker_home })
621625

622626
return 0
623627

0 commit comments

Comments
 (0)