archi-contribs / snow-import-plugin

Service Now import plugin
Other
14 stars 5 forks source link

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

Open Manj75 opened 4 years ago

Manj75 commented 4 years ago

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.

herve91 commented 4 years ago

The ServiceNow plugin was my first plugin. I had to learn Java, the Eclipse framework and the Archi internal classes. therefore, the graphical interface and error handling are very weak.

I will definitively improve them at some point

herve91 commented 4 years ago

Sorry, haven't found how to improve it very much.

Until I find, you'll have to connect to the web service manually and save it to a file, then go to the specified column using a text editor.