Skip to content

Be more specific regarding which exception to catch in data_utils.py - #4624

Closed
astrofrog wants to merge 1 commit into
astropy:masterfrom
astrofrog:more-specific-exception
Closed

astrofrog wants to merge 1 commit into
astropy:masterfrom
astrofrog:more-specific-exception

Conversation

@astrofrog

Copy link
Copy Markdown
Member

@taldcroft - while debugging an issue which ended up being due to numpy/numpy#7312, I noticed that this line was catching all exceptions, and hiding the numpy-dev issue. I think the intent was this was to make sure that string columns and other non-numerical columns didn't cause crashes, so I thought maybe we could be more specific?

@taldcroft

Copy link
Copy Markdown
Member

@astrofrog - I don't think in this particular case it is possible to be more specific because the input here is a list of arbitrary user functions that can fail in arbitrary ways. So for instance I might supply a function like:

def mean_inv(x):
    return np.mean(1.0 / x)

In the case where the data includes a zero then a ZeroDivisionError would be raised and not caught. The intent here was that the info attribute never fails to show something, and shows -- where the attribute is "not applicable".

@astrofrog

Copy link
Copy Markdown
Member Author

Ok - in that case, I'll close this. Thanks!

@astrofrog astrofrog closed this Feb 23, 2016
@astrofrog
astrofrog deleted the more-specific-exception branch July 5, 2016 18:46
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

Successfully merging this pull request may close these issues.

2 participants