Skip to content

DomainError needs 2 arguments #51

@blegat

Description

@blegat

The DomainError that is thrown is incorrect:

julia> @argcheck det(A) < 0 DomainError
ERROR: DomainError with det(A) < 0 must hold. Got
det(A) => 0.0:

Stacktrace:
 [1] throw_check_error(info::Any)
   @ ArgCheck ~/.julia/packages/ArgCheck/DaoPJ/src/checks.jl:283
 [2] top-level scope
   @ REPL[32]:1

It should throw DomainError(A, message), not DomainError(message). I tried:

julia> @check det(A) < 0 Base.Fix1(DomainError, A)
ERROR: MethodError: no method matching build_error(::ArgCheck.CallErrorInfo, ::ArgCheck.CheckFlavor, ::Base.Fix1{Type{DomainError}, Matrix{Float64}})
The function `build_error` exists, but no method is defined for this combination of argument types.

It would be nice if this syntax would work:

@check det(A) < 0 DomainError(A)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions