Skip to content

Deprecate error("msg")? #21886

@c42f

Description

@c42f

I've just been in contact with a new user, who was understandably using throw("my message") rather than throwing an ErrorException via error().

Do we need the conceptual overhead of having both error and throw? Why not conceptually have the following definitions:

throw(msg::AbstractString) = throw(ErrorException(msg))
throw(e::Exception) = builtin_throw(e)

A somewhat related question - what do we gain by allowing people to throw things which aren't subtypes of Exception?

Metadata

Metadata

Assignees

No one assigned

    Labels

    error handlingHandling of exceptions by Julia or the user

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions