nest-simulator icon indicating copy to clipboard operation
nest-simulator copied to clipboard

Standardize error message in PyNEST

Open babsey opened this issue 3 years ago • 8 comments

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 in Create 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.

babsey avatar Mar 09 '21 11:03 babsey

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))

Helveg avatar Mar 12 '21 11:03 Helveg

@babsey Would you be able to create a PR for this?

stinebuu avatar May 05 '21 12:05 stinebuu

I am waiting for merging #2022 to master branch. Then I will continue working on this issue.

babsey avatar May 05 '21 14:05 babsey

@babsey Since #2022 is merged, could you take another look at this one?

heplesser avatar Jun 30 '21 14:06 heplesser

Issue automatically marked stale!

github-actions[bot] avatar Sep 03 '21 08:09 github-actions[bot]

@babsey any updates on this?

stinebuu avatar Dec 17 '21 12:12 stinebuu

@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.

jougs avatar Dec 21 '21 11:12 jougs

Issue automatically marked stale!

github-actions[bot] avatar Feb 20 '22 08:02 github-actions[bot]