nest-simulator
nest-simulator copied to clipboard
Standardize error message in PyNEST
Describe the bug PyNEST raises errors in various aspects using
-
kernel.NESTError()
, e.g. in_process_syn_spec
and in_process_spatial_projections
functions (hl_api_connection_helper.py
) and inCreate
function (hl_api_nodes.py
). -
NESTErrors class
, e.g.NESTErrors.ArgumentType()
in_process_input_nodes
(hl_api_connection_helper.py
).
However these different error raises might give issues for nest-server
or in general.
It failed to get attribute errormessage
from these exceptions, because kernel.NESTError()
doesn't provide this attribute.
To Reproduce Steps to reproduce the behavior:
try:
<code to trigger any error>
except nest.kernel.NESTError as e:
print(getattr(e, 'errormessage'))
Expected behavior I propose a standard concept of the error objects. It means all error raises should apply the NESTError class.
I don't know if this is the case yet, but a class hierarchy of those error messages would also be useful for writing better quality Python code and tools:
try:
nest.Connect(...)
except nest.kernel.ConnectError as e:
print("Oops, connection errors")
except nest.kernel.KernelError as e:
print("Oops, uncaught error of type", type(e))
@babsey Would you be able to create a PR for this?
I am waiting for merging #2022 to master branch. Then I will continue working on this issue.
@babsey Since #2022 is merged, could you take another look at this one?
Issue automatically marked stale!
@babsey any updates on this?
@babsey and I have discussed off-line that we should probably postpone this a bit more until we're further along with the restructuring of PyNEST, which most likely also will lead to a restructuring of how we handle exceptions.
Issue automatically marked stale!