diff --git a/src/polynomials/chebyshev.jl b/src/polynomials/chebyshev.jl index 1d43a2f5..2b42e4b7 100644 --- a/src/polynomials/chebyshev.jl +++ b/src/polynomials/chebyshev.jl @@ -135,7 +135,8 @@ julia> c.(-1:0.5:1) ``` """ function evalpoly(x::S, ch::ChebyshevT) where {S} - x ∉ domain(ch) && throw(ArgumentError("$x outside of domain")) + d = domain(ch) + x ∉ d && throw(DomainError(x, "evaluation point must lie in $d")) evalpoly(x, ch, false) end diff --git a/test/ChebyshevT.jl b/test/ChebyshevT.jl index 6f66e174..5b05b59a 100644 --- a/test/ChebyshevT.jl +++ b/test/ChebyshevT.jl @@ -16,6 +16,8 @@ @test size(p, 1) == size(coeff, 1) @test typeof(p).parameters[2] == eltype(coeff) @test eltype(p) == eltype(coeff) + + @test_throws DomainError p(2) end end