nolta / Elliptic.jl

Elliptic integral and Jacobi elliptic special functions
MIT License
31 stars 16 forks source link

Fix DomainError exceptions #22

Closed Gregstrq closed 4 years ago

Gregstrq commented 4 years ago

The file "Elliptic.jl" contains a lot of throw(DomainError()) statements in the checks of parameter m. If m is outside the region [0.0,1.0], instead of producing DomainError exception, the code gives

MethodError: no method matching DomainError() Closest candidates are: DomainError(!Matched::Any) at boot.jl:258 DomainError(!Matched::Any, !Matched::Any) at boot.jl:259

I do not know what the situation was in earlier versions of Julia, but, apparently, the constructor of DomainError requires at least one argument to be passed now.

The issue is easily fixed by replacing all throw(DomainError()) statements with something like throw(DomainError(m, "Argument m ∉[0, 1]")).

I could make a pull request for this, however, I have a question about the status of extend domain to negative m #19. If that gets merged, the domain checks and error messages should be changed accordingly.