Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: David Widmann <[email protected]>
  • Loading branch information
penelopeysm and devmotion authored Sep 11, 2024
1 parent f73b630 commit 4ca1769
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/AbstractMCMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,14 @@ include("stepper.jl")
include("transducer.jl")
include("logdensityproblems.jl")

function __init__()
if isdefined(Base.Experimental, :register_error_hint)
if isdefined(Base.Experimental, :register_error_hint)
function __init__()
Base.Experimental.register_error_hint(MethodError) do io, exc, argtypes, _
if Base.parentmodule(exc.f) == LogDensityProblems &&
any(a -> a <: LogDensityModel, argtypes)
printstyled(
print(
io,
"\nAbstractMCMC.LogDensityModel is a wrapper and does not itself implement the LogDensityProblems.jl interface. To use LogDensityProblems.jl methods, access the inner type with (e.g.) `logdensity(model.logdensity, params)` instead of `logdensity(model, params)`.";
color=:cyan,
"\n`AbstractMCMC.LogDensityModel` is a wrapper and does not itself implement the LogDensityProblems.jl interface. To use LogDensityProblems.jl methods, access the inner type with (e.g.) `logdensity(model.logdensity, params)` instead of `logdensity(model, params)`.",
)
end
end
Expand Down

0 comments on commit 4ca1769

Please sign in to comment.