[ck2cti] Show name of species with undefined elements in error message
This commit is contained in:
parent
aa9721dbe9
commit
d04fd8cc39
1 changed files with 5 additions and 6 deletions
|
|
@ -1995,17 +1995,16 @@ class Parser(object):
|
|||
|
||||
def getSpeciesString(self, speciesList, indent):
|
||||
speciesNameLength = 1
|
||||
elementsFromSpecies = set()
|
||||
allElements = set(self.elements)
|
||||
for s in speciesList:
|
||||
if s.composition is None:
|
||||
raise InputParseError('No thermo data found for species: {0!r}'.format(s.label))
|
||||
elementsFromSpecies.update(s.composition)
|
||||
missingElements = set(s.composition) - allElements
|
||||
if missingElements:
|
||||
raise InputParseError("Undefined elements in species '{}':"
|
||||
" {}".format(s.label, ','.join(repr(e) for e in missingElements)))
|
||||
speciesNameLength = max(speciesNameLength, len(s.label))
|
||||
|
||||
missingElements = elementsFromSpecies - set(self.elements)
|
||||
if missingElements:
|
||||
raise InputParseError('Undefined elements: ' + str(missingElements))
|
||||
|
||||
speciesNames = ['']
|
||||
speciesPerLine = max(int((80-indent)/(speciesNameLength + 2)), 1)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue