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

DataAccess.get_data() error handling #76

Open
Eimert opened this issue Oct 22, 2017 · 0 comments
Open

DataAccess.get_data() error handling #76

Eimert opened this issue Oct 22, 2017 · 0 comments

Comments

@Eimert
Copy link

Eimert commented Oct 22, 2017

In case a symbol isn't found by the DataAccess.get_data() function, an error code should be returned to raise an exception.

>>> try:
...   c_dataobj.get_data(ldt_timestamps, ['OOMP'], ls_keys)[0]
... except:
...   logging.error('symbol not found')

Currently only a message is displayed, and NaNs are returned for the symbol in case:

Did not find path to OOMP. Looks like this file is missing
                     OOMP
2011-01-10 16:00:00   NaN
2011-01-11 16:00:00   NaN
(...) output ommitted

Suggested solution
In case a symbol is not found, return a non-zero exit code:
return 1
Or even better, raise an exception:

try:
    do_something(101)
except ValueError, e:
    print 'Did not find symbol ', symbol, 'error:', str(e)
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