Skip to content

Commit ececa17

Browse files
authored
Improve error message when initial_params / initial_state has wrong length (#163)
1 parent fdaa0eb commit ececa17

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
33
keywords = ["markov chain monte carlo", "probabilistic programming"]
44
license = "MIT"
55
desc = "A lightweight interface for common MCMC methods."
6-
version = "5.6.1"
6+
version = "5.6.2"
77

88
[deps]
99
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"

src/sample.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,15 +653,15 @@ tighten_eltype(x::Vector{Any}) = map(identity, x)
653653

654654
@nospecialize check_initial_params(x, n) = throw(
655655
ArgumentError(
656-
"initial parameters must be specified as a vector of length equal to the number of chains or `nothing`",
656+
"initial_params must be specified as a vector of length equal to the number of chains or `nothing`",
657657
),
658658
)
659659
check_initial_params(::Nothing, n) = nothing
660660
function check_initial_params(x::AbstractArray, n)
661661
if length(x) != n
662662
throw(
663663
ArgumentError(
664-
"incorrect number of initial parameters (expected $n, received $(length(x))"
664+
"the length of initial_params ($(length(x))) does not equal the number of chains ($n)",
665665
),
666666
)
667667
end
@@ -671,15 +671,15 @@ end
671671

672672
@nospecialize check_initial_state(x, n) = throw(
673673
ArgumentError(
674-
"initial states must be specified as a vector of length equal to the number of chains or `nothing`",
674+
"initial_state must be specified as a vector of length equal to the number of chains or `nothing`",
675675
),
676676
)
677677
check_initial_state(::Nothing, n) = nothing
678678
function check_initial_state(x::AbstractArray, n)
679679
if length(x) != n
680680
throw(
681681
ArgumentError(
682-
"incorrect number of initial states (expected $n, received $(length(x))"
682+
"the length of initial_state ($(length(x))) does not equal the number of chains ($n)",
683683
),
684684
)
685685
end

0 commit comments

Comments
 (0)