Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define a dedicated Exception class to report missing neural datatypes #1144

Closed
yarikoptic opened this issue Jan 17, 2020 · 5 comments
Closed
Labels
category: enhancement improvements of code or code behavior

Comments

@yarikoptic
Copy link
Contributor

ATM:

(Pdb) p exc
KeyError("'AIBS_ecephys' not a namespace")
(Pdb) p type(exc)
<class 'KeyError'>

so it is a very generic KeyError, so until #1143 is implemented, for programmatic handling of such situations it requires regex matching of the exception message to decide that it is indeed the exception reporting missing type, and extracting the name. Ideally it should be a dedicated exception with ease access to the name of missing type (e.g. via attribute of that exception).

@yarikoptic yarikoptic added the category: enhancement improvements of code or code behavior label Jan 17, 2020
yarikoptic added a commit to dandi/dandi-cli that referenced this issue Jan 17, 2020
…ing exception with AIBS_ecephys listed missing

Ultimate solution should IMHO be implemented within PyNWB itself.
See NeurodataWithoutBorders/pynwb#1143 feature request.
Also related - dedicated exception (NeurodataWithoutBorders/pynwb#1144)

With this change we should be able to deal with neuropixels files from Allen
@bendichter
Copy link
Contributor

@yarikoptic Do you mean something like this?

class HDMFMissingNamespaceException(Exception):
    def __init__(self, namespace):
        self.namespace = namespace
        super().init("'{}' not a namespace".format(namespaace))

@oruebel
Copy link
Contributor

oruebel commented Nov 3, 2020

I would suggest transferring this issue to HDMF and potentially merging it with hdmf-dev/hdmf#340

At that point we should also add support to add additional details to the message to allow us to address #1143

@bendichter
Copy link
Contributor

Yes, I agree, but I don't think I have transfer permissions to that repo

@rly
Copy link
Contributor

rly commented Nov 4, 2020

You can only transfer issues between repositories owned by the same user or organization account.
https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/transferring-an-issue-to-another-repository

I will start a new issue in hdmf and link back to this.

@rly
Copy link
Contributor

rly commented Nov 4, 2020

Scratch that. We can just add to hdmf-dev/hdmf#340

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: enhancement improvements of code or code behavior
Projects
None yet
Development

No branches or pull requests

4 participants