Skip to content

Suggested improvement on errror reporting #50

@jackdeguest

Description

@jackdeguest

In JSON, when encoding, and when dealing with a blessed object and all attempts have failed, the module yields something like: encountered object 'XXX', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) where XXX is the object reference.

When the object has overload stringification capability, this error message becomes unhelpful, because we do not know the source of the issue, i.e. which package is at fault. Thus, I would recommend changing the error to use overload::StrVal( $obj ). Maybe something like:

encode_error( sprintf("encountered object '%s', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing)", overload::StrVal($obj))

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