suny-downstate-medical-center / netpyne

A Python package to facilitate the development, parallel simulation, optimization and analysis of multiscale biological neuronal networks in NEURON.
http://www.netpyne.org
MIT License
142 stars 134 forks source link

[other] load_file return value is not considered #782

Closed aranega closed 4 months ago

aranega commented 8 months ago

Currently, the importCellParams method uses the importCell function which loads .hoc file using the load_file function from NEURON. The load_file function returns 0 when an error occured (file not found, or an interpreter error while loading the file), but doesn't trigger any exception. In case the load_file fails, there is no way of knowing that an error happened. It would be interesting to get the error code and to raise a dedicated exception in case the function fails. That would let nepyne users the possibility to implement their own error handling :)

vvbragin commented 4 months ago

Hi @aranega thanks for noting this. For now we don't have any netpyne-specific expection types, so I'm just throwing a default exception if load_file return zero code: https://github.com/suny-downstate-medical-center/netpyne/commit/a7c06ec8f760d8ea136ef950d2d66e1f024df394