Skip to content

Commit 5f11309

Browse files
committed
throw ArgumentError instead of ErrorException
1 parent c68231e commit 5f11309

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/definitions.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ struct Frequencies{T<:Number} <: AbstractVector{T}
405405
multiplier::T
406406

407407
Frequencies(n_nonnegative::Int, n::Int, multiplier::T) where {T<:Number} = begin
408-
1 n_nonnegative n || error("Condition 1 ≤ n_nonnegative ≤ n isn't satisfied.")
408+
1 n_nonnegative n || throw(ArgumentError("Condition 1 ≤ n_nonnegative ≤ n isn't satisfied."))
409409
return new{T}(n_nonnegative, n, multiplier)
410410
end
411411
end

test/runtests.jl

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ end
9696
@test fftfreq(5, 2) == [0.0, 0.4, 0.8, -0.8, -0.4]
9797
# <:Number type compatibility
9898
@test eltype(fftfreq(5, ComplexF64(2))) == ComplexF64
99+
100+
@test_throws ArgumentError Frequencies(12, 10, 1)
99101
end
100102

101103
@testset "normalization" begin

0 commit comments

Comments
 (0)