FermiQC / Fermi.jl

Fermi quantum chemistry program
MIT License
134 stars 24 forks source link

Improve Error messages #96

Closed gustavojra closed 2 years ago

gustavojra commented 3 years ago

When invalid arguments are passed into a function, e.g. Fermi.MollerPlesset.RMP2 the error message is too long because it prints the actual arguments (that could be huge arrays).

It is best if change it to show only the types. For example:

function RMP2(x...)
    if !any(i-> i isa RMP2Algorithm, x)
        RMP2(x..., get_rmp2_alg())
    else
        # Print the type of arguments given for a better feedback
        args = "("
        for a in x[1:end-1]
            args *= "$(typeof(a)), "
        end
        args = args[1:end-2]*")"
        throw(FermiException("invalid arguments for RMP2 method: $args"))
    end
end
gustavojra commented 2 years ago

That has been fixed sometime in the past