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

Error messages using @assert need to be turned into normal exceptions #105

Closed
akabla opened this issue Apr 7, 2021 · 2 comments
Closed
Labels
invalid This doesn't seem right

Comments

@akabla
Copy link
Member

akabla commented Apr 7, 2021

We deal with many errors in parameters with an @assert macro. For instance:
@assert hastime(d) "Data without time information cannot be resampled."

@assert may be disabled with certain optimisations, and therefore not appropriate for this usage.
https://docs.julialang.org/en/v1/base/base/#Base.@assert

It would be more appropriate to reserve @assert for debugging purposes only, and use proper exceptions for error message supposed to be helpful to the user.

This page may be useful:
https://scls.gitbooks.io/ljthw/content/_chapters/11-ex8.html

@akabla akabla added the invalid This doesn't seem right label Apr 7, 2021
@moustachio-belvedere
Copy link
Member

Important issue, but I think this is duplicated:

#81

@akabla
Copy link
Member Author

akabla commented Apr 7, 2021

indeed! let me close this here - no need to have it twice.

@akabla akabla closed this as completed Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants