Skip to content

Json::Exception broken #216

Closed
Closed
@Dani-Hub

Description

@Dani-Hub

The new exception class Json::Exception contains a data member of reference type. That means the initializing object is required to have a longer life-time than the exception class. But this does not happen: The class is always constructed by temporaries, so there are nasal daemons all around!

I do not understand the reason to why a member reference has been chosen, but that is clearly wrong here. I suggest to replace the reference member by a normal non-reference member of type std::string that copies the provided argument.

That being said: Why does the public header value.h declare the internal exception types and the corresponding factory functions? It would seem better (regarding implementation encapsulation) to move these declarations instead into an internal header (part of src, not part of include).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions