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

Make AstropyWarning be more informative #5592

Open
taldcroft opened this issue Dec 12, 2016 · 0 comments
Open

Make AstropyWarning be more informative #5592

taldcroft opened this issue Dec 12, 2016 · 0 comments

Comments

@taldcroft
Copy link
Member

As mentioned by @cdeil in #5586, figuring out exactly where a warning was emitted is often tricky. The base AstropyWarning class seems to make this even worse by entirely suppressing line/file information in the output in favor of a cleaner display.

One thing that can help is including an appropriate stacklevel kwarg in the warn call, where this refers to the number of stack levels up where one expects the original user call. Granted that is not always predictable, but in many cases it is and would then allow users to see where in their code the warning originated. An example is in #5586 where stacklevel=3 always gets back to the user call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants