Skip to content

Feature request: Improved JSON debugging #67

@robinsmidsrod

Description

@robinsmidsrod

Whenever I send an invalid command to the CP I'm getting this information in the log:

10/1/2023, 1:44:08 PM    node: OCPP Server Port 9595     type: ERROR     data: Unexpected token
 in JSON at position 96

First of all, the token part (when looked in a hex editor) is the symbol ^@, which I'm not sure what represents.

When I try to determine which part of of the message is wrong, by copying the message I think is the problem into a text editor and find the position mentioned, it is commonly outside the end of the string. It makes it quite non-trivial to use this message for anything else than knowing there was an error, but not really where in your syntax the error was.

Is it possible to improve this? Maybe include some characters before or after the position mentioned, and using maybe a special symbol injected into the position to symbolize from where the issue started.

If this is an error message coming from the CP (which obviously can't be modified), is it possible to dump the unaltered JSON that caused the error to the log at the same time as you output the error, so it's easier to debug?

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