Merge pull request #1097 from citibeth/efischer/160622-DBErrors

Improved Spack database errors to help users fix them.
This commit is contained in:
Todd Gamblin 2016-06-26 22:45:44 -07:00 committed by GitHub
commit 19b69ce3a5

View file

@ -631,11 +631,13 @@ def _exit(self):
class CorruptDatabaseError(SpackError): class CorruptDatabaseError(SpackError):
def __init__(self, path, msg=''): def __init__(self, path, msg=''):
super(CorruptDatabaseError, self).__init__( super(CorruptDatabaseError, self).__init__(
"Spack database is corrupt: %s. %s" % (path, msg)) "Spack database is corrupt: %s. %s." + \
"Try running `spack reindex` to fix." % (path, msg))
class InvalidDatabaseVersionError(SpackError): class InvalidDatabaseVersionError(SpackError):
def __init__(self, expected, found): def __init__(self, expected, found):
super(InvalidDatabaseVersionError, self).__init__( super(InvalidDatabaseVersionError, self).__init__(
"Expected database version %s but found version %s" % "Expected database version %s but found version %s." + \
"Try running `spack reindex` to fix." %
(expected, found)) (expected, found))