Permalink
Browse files

notary_http - raise ValueError instead of adapting

It's better to let the user know something is wrong
  • Loading branch information...
daveschaefer committed Nov 11, 2012
1 parent 660f5c4 commit 50b48eb81287443e3e68fcb4d97b2160a23a4ae2
Showing with 4 additions and 3 deletions.
  1. +1 −0 AUTHORS
  2. +2 −2 notary_http.py
  3. +1 −1 test/Network Notary Test Cases.txt
View
@@ -6,4 +6,5 @@ With many thanks to the following contributors:
Kyle Anderson
Dinesh Israni
Dave Schaefer
+mwgamera
Von Welch
View
@@ -91,8 +91,8 @@ def __init__(self):
if (self.ENV_PORT_KEY_NAME in os.environ):
self.web_port = int(os.environ[self.ENV_PORT_KEY_NAME])
else:
- print >> sys.stderr, "ERROR: envport option specified but no '%s' variable exists. Falling back to port %s." % \
- (self.ENV_PORT_KEY_NAME, self.web_port)
+ raise ValueError("--envport option specified but no '%s' variable exists." % \
+ (self.ENV_PORT_KEY_NAME))
elif (args.webport):
self.web_port = args.webport
@@ -18,7 +18,7 @@ Arguments
- If neither is specifed do we use the default port?
- If webport is specefied but is not an integer, does argparse reject it?
- If webport is specified and is an integer, and no envport is given, do we use the webport?
- - If envport is specified but no environment variable by that name exists, do we log a warning and fall back to the default?
+ - If envport is specified but no environment variable by that name exists, do we throw a ValueError?
- If envport is specified and the env var exists but is not an integer, do we throw a ValueError?
- If envport is specified and the env var exists and is a valid integer, do we use it?
- If both are specified, does argparse reject that usage?

0 comments on commit 50b48eb

Please sign in to comment.