Skip to content

Commit f2d5e8b

Browse files
committed
Exception catching for failure to load .g file
1 parent 95e35cc commit f2d5e8b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

simWrapMoose.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,11 @@ def loadModelFile( self, fname, modifyFunc, scaleParam, dumpFname, paramFname, c
369369
if file_extension == '.xml':
370370
self.modelId, errormsg = moose.readSBML( fname, 'model', 'ee' )
371371
elif file_extension == '.g':
372-
self.modelId = moose.loadModel( fname, 'model', 'ee' )
372+
try:
373+
self.modelId = moose.loadModel( fname, 'model', 'ee' )
374+
except RuntimeError:
375+
print( "simWrapMoose: Failed to load .g file '{}'".format(fname) )
376+
raise SimError( "Failed to load .g file '{}'".format(fname))
373377
# moose.delete('/model[0]/kinetics[0]/compartment_1[0]')
374378
elif file_extension == '.py':
375379
# Assume a moose script for creating the model in rdesigneur.

0 commit comments

Comments
 (0)