in appcenter-crashes/android/src/main/java/com/microsoft/appcenter/reactnative/crashes/AppCenterReactNativeCrashesUtils.java [49:80]
static WritableMap convertErrorReportToWritableMap(ErrorReport errorReport) throws JSONException {
if (errorReport == null) {
return Arguments.createMap();
}
WritableMap errorReportMap = Arguments.createMap();
errorReportMap.putString("id", errorReport.getId());
errorReportMap.putString("threadName", errorReport.getThreadName());
errorReportMap.putString("appErrorTime", "" + errorReport.getAppErrorTime().getTime());
errorReportMap.putString("appStartTime", "" + errorReport.getAppStartTime().getTime());
String stackTrace = errorReport.getStackTrace();
if (stackTrace != null) {
errorReportMap.putString("exception", stackTrace);
}
/* Convert device info. */
Device deviceInfo = errorReport.getDevice();
WritableMap deviceInfoMap;
if (deviceInfo != null) {
JSONStringer jsonStringer = new JSONStringer();
jsonStringer.object();
deviceInfo.write(jsonStringer);
jsonStringer.endObject();
JSONObject deviceInfoJson = new JSONObject(jsonStringer.toString());
deviceInfoMap = RNUtils.convertJsonObjectToWritableMap(deviceInfoJson);
} else {
/* TODO investigate why this can be null. */
deviceInfoMap = Arguments.createMap();
}
errorReportMap.putMap("device", deviceInfoMap);
return errorReportMap;
}