Skip to content

DataAccess.get_data() error handling #76

@Eimert

Description

@Eimert

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions