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

Raise exceptions when using the methods outside the CLI #124

Open
avivace opened this issue Aug 4, 2021 · 0 comments
Open

Raise exceptions when using the methods outside the CLI #124

avivace opened this issue Aug 4, 2021 · 0 comments

Comments

@avivace
Copy link

avivace commented Aug 4, 2021

When using cernopendata-client as a module and importing the searcher (or downloader) method, any error will cause the entire execution flow to break. This should happen when using the cernopendata-client CLI, but elsewhere those methods should raise an Exception that the importing application can handle and carry on.

E.g., When you look for a non-existing record id:

from cernopendata_client import searcher, downloader
metadata = searcher.get_record_as_json(server=self.SERVER_HTTP_URI, recid=recid)

The script exists immediatly (without raising any Exception) and interrupting any calling action:

==> ERROR: The record id number you supplied is not valid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant