Skip to content

When Java exception is thrown due to JSON parse log the raw JSON for the culprit CI #6

@Manj75

Description

@Manj75

To improve on error handling and better diagnostics it would be good where an exception is thrown due to the format of the JSON an error is logged with the part of the response that caused the exception. Crucially, the sys_id of the parent/relationship/child would be handy to trace that back in SN.

When parsing our CMDB I'm see the following, but due to the size of the data set and lack of verbose message log I cannot pinpoint:

2019-09-18 12:58:32 DEBUG 719:MyImporter - Generated URL is https://nextdev.service-now.com/api/now/table/cmdb_rel_ci?sysparm_limit=850000&sysparm_fields=operational_status,sys_id,parent,type,sys_class_name,child&sysparm_query=&sysparm_exclude_reference_link=false
2019-09-18 12:58:35 TRACE 71:MyConnection - Getting relations from ServiceNow webservice ...
2019-09-18 12:59:33 TRACE 87:MyConnection - Read 65055088 bytes from ServiceNow webservice.
2019-09-18 12:59:34 FATAL 16:MyPopup - Cannot get relations from ServiceNow web service: org.codehaus.jackson.JsonParseException: Unexpected character (']' (code 93)): expected a value at [Source: java.io.StringReader@624fedfd; line: 1, column: 65054829]
2019-09-18 13:03:01 INFO 916:MyImporter - 0 relations have been modified: 0 created, 0 updated, 0 removed.

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