Skip to content

Commit 6da2557

Browse files
authored
Throw DomainError for out-of-domain evaluation (#538)
1 parent 9f6b745 commit 6da2557

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/polynomials/chebyshev.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ julia> c.(-1:0.5:1)
135135
```
136136
"""
137137
function evalpoly(x::S, ch::ChebyshevT) where {S}
138-
x domain(ch) && throw(ArgumentError("$x outside of domain"))
138+
d = domain(ch)
139+
x d && throw(DomainError(x, "evaluation point must lie in $d"))
139140
evalpoly(x, ch, false)
140141
end
141142

test/ChebyshevT.jl

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
@test size(p, 1) == size(coeff, 1)
1717
@test typeof(p).parameters[2] == eltype(coeff)
1818
@test eltype(p) == eltype(coeff)
19+
20+
@test_throws DomainError p(2)
1921
end
2022
end
2123

0 commit comments

Comments
 (0)