Skip to content

Commit 24dd2d8

Browse files
committed
fix error handling. better formatting
1 parent 1f4d4c8 commit 24dd2d8

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

netpyne_ui/netpyne_geppetto.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def instantiateNetPyNEModelInGeppetto(self, args):
6060
self.geppetto_model = self.model_interpreter.getGeppettoModel(netpyne_model)
6161

6262
return json.loads(GeppettoModelSerializer().serialize(self.geppetto_model))
63-
except Exception as e:
64-
return utils.getJSONError("Error while instantiating the NetPyNE model", e)
63+
except:
64+
return utils.getJSONError("Error while instantiating the NetPyNE model", sys.exc_info())
6565

6666
def simulateNetPyNEModelInGeppetto(self, args):
6767
try:
@@ -100,7 +100,7 @@ def simulateNetPyNEModelInGeppetto(self, args):
100100

101101
return json.loads(GeppettoModelSerializer().serialize(self.geppetto_model))
102102
except:
103-
return utils.getJSONError("Error while simulating the NetPyNE model",traceback.format_exc())
103+
return utils.getJSONError("Error while simulating the NetPyNE model", sys.exc_info())
104104

105105
def compileModMechFiles(self, compileMod, modFolder):
106106
#Create Symbolic link
@@ -134,7 +134,7 @@ def remove(dictionary):
134134
owd = os.getcwd()
135135
self.compileModMechFiles(args['compileMod'], args['modFolder'])
136136
except:
137-
return utils.getJSONError("Error while importing/compiling mods",traceback.format_exc())
137+
return utils.getJSONError("Error while importing/compiling mods", sys.exc_info())
138138
finally:
139139
os.chdir(owd)
140140

@@ -189,7 +189,7 @@ def remove(dictionary):
189189
else:
190190
return utils.getJSONReply()
191191
except:
192-
return utils.getJSONError("Error while loading the NetPyNE model",traceback.format_exc())
192+
return utils.getJSONError("Error while loading the NetPyNE model", sys.exc_info())
193193

194194
def importModel(self, modelParameters):
195195
try:
@@ -223,7 +223,7 @@ def importModel(self, modelParameters):
223223

224224
return utils.getJSONReply()
225225
except:
226-
return utils.getJSONError("Error while importing the NetPyNE model",traceback.format_exc())
226+
return utils.getJSONError("Error while importing the NetPyNE model", sys.exc_info())
227227
finally:
228228
os.chdir(owd)
229229

@@ -243,7 +243,7 @@ def importCellTemplate(self, modelParameters, modFolder, compileMod):
243243

244244
return utils.getJSONReply()
245245
except:
246-
return utils.getJSONError("Error while importing the NetPyNE cell template",traceback.format_exc())
246+
return utils.getJSONError("Error while importing the NetPyNE cell template", sys.exc_info())
247247
finally:
248248
os.chdir(owd)
249249

@@ -260,15 +260,15 @@ def exportModel(self, args):
260260
sim.cfg.saveJson = False
261261
return utils.getJSONReply()
262262
except:
263-
return utils.getJSONError("Error while exporting the NetPyNE model",traceback.format_exc())
263+
return utils.getJSONError("Error while exporting the NetPyNE model", sys.exc_info())
264264

265265
def exportNeuroML(self, modelParams):
266266
try:
267267
with redirect_stdout(sys.__stdout__):
268268
sim.exportNeuroML2(modelParams['fileName'], specs.SimConfig())
269269
return utils.getJSONReply()
270270
except:
271-
return utils.getJSONError("Error while exporting the NetPyNE model", traceback.format_exc())
271+
return utils.getJSONError("Error while exporting the NetPyNE model", sys.exc_info())
272272

273273
def importNeuroML(self, modelParams):
274274
try:
@@ -279,7 +279,7 @@ def importNeuroML(self, modelParams):
279279
return json.loads(GeppettoModelSerializer().serialize(self.geppetto_model))
280280

281281
except:
282-
return utils.getJSONError("Error while exporting the NetPyNE model",traceback.format_exc())
282+
return utils.getJSONError("Error while exporting the NetPyNE model", sys.exc_info())
283283

284284
def deleteModel(self, modelParams):
285285
try:
@@ -293,7 +293,7 @@ def deleteModel(self, modelParams):
293293
return utils.getJSONReply()
294294

295295
except:
296-
return utils.getJSONError("Error while exporting the NetPyNE model",traceback.format_exc())
296+
return utils.getJSONError("Error while exporting the NetPyNE model", sys.exc_info())
297297

298298
def instantiateNetPyNEModel(self):
299299
with redirect_stdout(sys.__stdout__):
@@ -485,7 +485,7 @@ def header(title, spacer='-'):
485485
return utils.getJSONReply()
486486

487487
except:
488-
return utils.getJSONError("Error while importing the NetPyNE model", traceback.format_exc())
488+
return utils.getJSONError("Error while importing the NetPyNE model", sys.exc_info())
489489

490490
logging.info("Initialising NetPyNE UI")
491491
netpyne_geppetto = NetPyNEGeppetto()

0 commit comments

Comments
 (0)