Skip to content

Unifying error messages. #747

@trappmartin

Description

@trappmartin

At the moment the error messages are all over the place and highly inconsistent. For example the assume function in HMC uses three different types of error messages.

I think we should have a consistent way of doing this. Maybe we can have a simple function that generates those error messages, e.g.

tmsg(msg::AbstractString, scope:: AbstractString) = "Turing [$scope]: $msg"

which would be used as follows:

@assert length(dists) == 1 tmsg("Turing only support vectorizing i.i.d distribution", "HMC.assume")
@assert size(var) == size(rs) tmsg("Variable and random number dimension unmatched.", "HMC.assume")
error("Unsupported variable container", "HMC.assume")

I guess we could also write a macro for this but I'm not sure its worth the efforts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions