Skip to content

Commit

Permalink
improved error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
jbecla committed Sep 17, 2015
1 parent 6e058dc commit 8b971b3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python/lsst/db/engineFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"""

# standard library imports
from ConfigParser import ConfigParser
from ConfigParser import ConfigParser, NoSectionError
import logging as log
import os

Expand Down Expand Up @@ -64,7 +64,12 @@ def getEngineFromFile(fileName):
fileName = os.path.expanduser(fileName)
parser = ConfigParser()
parser.readfp(open(fileName), fileName)
options = dict(parser.items("database"))
try:
options = dict(parser.items("database"))
except NoSectionError:
log.error("File %s does not contain section 'database'" % fileName)
raise

return sqlalchemy.engine_from_config(options, "")

####################################################################################
Expand Down

0 comments on commit 8b971b3

Please sign in to comment.