diff --git a/src/polynomials/chebyshev.jl b/src/polynomials/chebyshev.jl index bbad037b..514e7767 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 1a1effd4..03eaa594 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