Skip to content

Better error debugging for generation #710

@mperham

Description

@mperham

I'm trying to figure out why JSON is blowing up when generating the JSON for a big ole Hash of stuff. It raises a GeneratorError, but with no context so I can't easily tell where my bad data is. The line in question is here:

rb_raise(rb_path2class("JSON::GeneratorError"), "source sequence is illegal/malformed utf-8");

I would suggest this error include the relevant object at fault. Something like:

class JSON::GeneratorError
  attr_reader :invalid_element
end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions