Skip to content

Error message gives internal location, not loc of the error #22

@jimav

Description

@jimav

If an unknown attribute is specified in a constructor call, the error looks like this:

Found unknown attribute(s) passed to the constructor: wrong at (eval 13) line 53.

Which is not very helpful because line 53 is somewhere in the internals, i.e. not the location of the erroneous call.
Errors from other places, such as a missing required attribute, give better message like

 Missing required arguments: x at main.pl line 13.

where "main.pl line 13" is the location of the erroneous call.

Can MooX::StrictConstructor be made to provide similar error messages, showing the location of the error?

The pod says a traceback isn't provided for security reasons and Your application can use Carp::Always to generate stack traces on "die". which is fine if someone really needs a full stack trace including sub arguments. Showing only the location of the error should not be a problem, particularly because other kinds of errors show it like the example given.

MooX::StrictConstructor version 0.011
Perl version 5.36.0

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