Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

give a better error message for missing envvar #1163

Closed
chadwhitacre opened this issue Jul 17, 2013 · 0 comments
Closed

give a better error message for missing envvar #1163

chadwhitacre opened this issue Jul 17, 2013 · 0 comments

Comments

@chadwhitacre
Copy link
Contributor

@jeromegn got burned over on #1157 when he rebased his local branch on master, because we had added a dependency on a new key in local.env and of course he didn't have it:

pid-60504 thread-140735195500928 (MainThread) Oh no! Aspen crashed!
pid-60504 thread-140735195500928 (MainThread) Traceback (most recent call last):
pid-60504 thread-140735195500928 (MainThread)   File "/Users/jgn/projects/www.gittip.com/env/lib/python2.7/site-packages/aspen/server.py", line 125, in main
pid-60504 thread-140735195500928 (MainThread)     _main(argv)
pid-60504 thread-140735195500928 (MainThread)   File "/Users/jgn/projects/www.gittip.com/env/lib/python2.7/site-packages/aspen/server.py", line 51, in _main
pid-60504 thread-140735195500928 (MainThread)     website = Website(argv)
pid-60504 thread-140735195500928 (MainThread)   File "/Users/jgn/projects/www.gittip.com/env/lib/python2.7/site-packages/aspen/website.py", line 30, in __init__
pid-60504 thread-140735195500928 (MainThread)     self.configure(argv)
pid-60504 thread-140735195500928 (MainThread)   File "/Users/jgn/projects/www.gittip.com/env/lib/python2.7/site-packages/aspen/configuration/__init__.py", line 382, in configure
pid-60504 thread-140735195500928 (MainThread)     execfile(filepath, {'website': self})
pid-60504 thread-140735195500928 (MainThread)   File "/Users/jgn/projects/www.gittip.com/configure-aspen.py", line 90, in <module>
pid-60504 thread-140735195500928 (MainThread)     UPDATE_HOMEPAGE_EVERY = int(os.environ['UPDATE_HOMEPAGE_EVERY'])
pid-60504 thread-140735195500928 (MainThread)   File "/Users/jgn/projects/www.gittip.com/env/lib/python2.7/UserDict.py", line 23, in __getitem__
pid-60504 thread-140735195500928 (MainThread)     raise KeyError(key)
pid-60504 thread-140735195500928 (MainThread) KeyError: 'UPDATE_HOMEPAGE_EVERY'
^Cpid-60504 thread-140735195500928 (MainThread) Received INT, exiting.

Our design is to require all keys in every *.env file. We don't have defaults, because then the risk is greater of leaking development settings into production or vice versa, depending on which defaults we pick. What we can do, however, is give a nicer error message when a key is missing.

galuszkak added a commit to Solution4Future/www.gittip.com that referenced this issue Jan 4, 2014
This introduces bitcoin address field in gittip profile
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant