Skip to content

Commit f462168

Browse files
committed
Check if error is not null and add SDK version to requests
1 parent 6932003 commit f462168

File tree

7 files changed

+125
-121
lines changed

7 files changed

+125
-121
lines changed

docs/Countly.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3319,7 +3319,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="Countl
33193319
<br class="clear">
33203320

33213321
<footer>
3322-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sat Oct 22 2016 11:08:24 GMT+0300 (FLE Summer Time)
3322+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Dec 01 2016 11:51:35 GMT+0200 (FLE Standard Time)
33233323
</footer>
33243324

33253325
<script> prettyPrint(); </script>

docs/Countly.userData.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="Countl
17381738
<br class="clear">
17391739

17401740
<footer>
1741-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sat Oct 22 2016 11:08:24 GMT+0300 (FLE Summer Time)
1741+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Dec 01 2016 11:51:35 GMT+0200 (FLE Standard Time)
17421742
</footer>
17431743

17441744
<script> prettyPrint(); </script>

docs/countly.js.html

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ <h1 class="page-title">Source: countly.js</h1>
10621062
request.app_key = Countly.app_key;
10631063
request.device_id = Countly.device_id;
10641064
request.sdk_name = SDK_NAME;
1065-
//request.sdk_version = SDK_VERSION;
1065+
request.sdk_version = SDK_VERSION;
10661066

10671067
if(Countly.country_code)
10681068
request.country_code = Countly.country_code;
@@ -1261,60 +1261,62 @@ <h1 class="page-title">Source: countly.js</h1>
12611261
}
12621262

12631263
function recordError(err, nonfatal, segments){
1264-
segments = segments || crashSegments;
1265-
var error = "";
1266-
if(typeof err === "object"){
1267-
if(typeof err.stack !== "undefined")
1268-
error = err.stack;
1264+
if(err){
1265+
segments = segments || crashSegments;
1266+
var error = "";
1267+
if(typeof err === "object"){
1268+
if(typeof err.stack !== "undefined")
1269+
error = err.stack;
1270+
else{
1271+
if(typeof err.name !== "undefined")
1272+
error += err.name+":";
1273+
if(typeof err.message !== "undefined")
1274+
error += err.message+"\n";
1275+
if(typeof err.fileName !== "undefined")
1276+
error += "in "+err.fileName+"\n";
1277+
if(typeof err.lineNumber !== "undefined")
1278+
error += "on "+err.lineNumber;
1279+
if(typeof err.columnNumber !== "undefined")
1280+
error += ":"+err.columnNumber;
1281+
}
1282+
}
12691283
else{
1270-
if(typeof err.name !== "undefined")
1271-
error += err.name+":";
1272-
if(typeof err.message !== "undefined")
1273-
error += err.message+"\n";
1274-
if(typeof err.fileName !== "undefined")
1275-
error += "in "+err.fileName+"\n";
1276-
if(typeof err.lineNumber !== "undefined")
1277-
error += "on "+err.lineNumber;
1278-
if(typeof err.columnNumber !== "undefined")
1279-
error += ":"+err.columnNumber;
1284+
error = err+"";
12801285
}
1286+
nonfatal = (nonfatal) ? true : false;
1287+
var metrics = getMetrics();
1288+
var ob = {_resolution:metrics._resolution, _error:error, _app_version:metrics._app_version, _run:getTimestamp()-startTime};
1289+
1290+
ob._not_os_specific = true;
1291+
1292+
var battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery || navigator.msBattery;
1293+
if (battery)
1294+
ob._bat = Math.floor(battery.level * 100);
1295+
1296+
if(typeof navigator.onLine !== 'undefined')
1297+
ob._online = (navigator.onLine) ? true : false;
1298+
1299+
ob._background = (document.hasFocus()) ? false : true;
1300+
1301+
if(crashLogs.length > 0)
1302+
ob._logs = crashLogs.join("\n");
1303+
crashLogs = [];
1304+
ob._nonfatal = nonfatal;
1305+
1306+
ob._view = (window.location.pathname || "")+(window.location.search || "")+(window.location.hash || "");
1307+
1308+
if(typeof segments !== "undefined")
1309+
ob._custom = segments;
1310+
1311+
try{
1312+
var canvas = document.createElement("canvas");
1313+
var gl = canvas.getContext("experimental-webgl");
1314+
ob._opengl = gl.getParameter(gl.VERSION);
1315+
}
1316+
catch(ex){}
1317+
1318+
toRequestQueue({crash: JSON.stringify(ob)});
12811319
}
1282-
else{
1283-
error = err+"";
1284-
}
1285-
nonfatal = (nonfatal) ? true : false;
1286-
var metrics = getMetrics();
1287-
var ob = {_resolution:metrics._resolution, _error:error, _app_version:metrics._app_version, _run:getTimestamp()-startTime};
1288-
1289-
ob._not_os_specific = true;
1290-
1291-
var battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery || navigator.msBattery;
1292-
if (battery)
1293-
ob._bat = Math.floor(battery.level * 100);
1294-
1295-
if(typeof navigator.onLine !== 'undefined')
1296-
ob._online = (navigator.onLine) ? true : false;
1297-
1298-
ob._background = (document.hasFocus()) ? false : true;
1299-
1300-
if(crashLogs.length > 0)
1301-
ob._logs = crashLogs.join("\n");
1302-
crashLogs = [];
1303-
ob._nonfatal = nonfatal;
1304-
1305-
ob._view = (window.location.pathname || "")+(window.location.search || "")+(window.location.hash || "");
1306-
1307-
if(typeof segments !== "undefined")
1308-
ob._custom = segments;
1309-
1310-
try{
1311-
var canvas = document.createElement("canvas");
1312-
var gl = canvas.getContext("experimental-webgl");
1313-
ob._opengl = gl.getParameter(gl.VERSION);
1314-
}
1315-
catch(ex){}
1316-
1317-
toRequestQueue({crash: JSON.stringify(ob)});
13181320
}
13191321

13201322
//sending xml HTTP request
@@ -1582,7 +1584,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="Countl
15821584
<br class="clear">
15831585

15841586
<footer>
1585-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sat Oct 22 2016 11:08:24 GMT+0300 (FLE Summer Time)
1587+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Dec 01 2016 11:51:35 GMT+0200 (FLE Standard Time)
15861588
</footer>
15871589

15881590
<script> prettyPrint(); </script>

docs/global.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="Countl
15311531
<br class="clear">
15321532

15331533
<footer>
1534-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sat Oct 22 2016 11:08:24 GMT+0300 (FLE Summer Time)
1534+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Dec 01 2016 11:51:35 GMT+0200 (FLE Standard Time)
15351535
</footer>
15361536

15371537
<script> prettyPrint(); </script>

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="Countl
101101
<br class="clear">
102102

103103
<footer>
104-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sat Oct 22 2016 11:08:24 GMT+0300 (FLE Summer Time)
104+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Dec 01 2016 11:51:35 GMT+0200 (FLE Standard Time)
105105
</footer>
106106

107107
<script> prettyPrint(); </script>

lib/countly.js

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@
10341034
request.app_key = Countly.app_key;
10351035
request.device_id = Countly.device_id;
10361036
request.sdk_name = SDK_NAME;
1037-
//request.sdk_version = SDK_VERSION;
1037+
request.sdk_version = SDK_VERSION;
10381038

10391039
if(Countly.country_code)
10401040
request.country_code = Countly.country_code;
@@ -1233,60 +1233,62 @@
12331233
}
12341234

12351235
function recordError(err, nonfatal, segments){
1236-
segments = segments || crashSegments;
1237-
var error = "";
1238-
if(typeof err === "object"){
1239-
if(typeof err.stack !== "undefined")
1240-
error = err.stack;
1236+
if(err){
1237+
segments = segments || crashSegments;
1238+
var error = "";
1239+
if(typeof err === "object"){
1240+
if(typeof err.stack !== "undefined")
1241+
error = err.stack;
1242+
else{
1243+
if(typeof err.name !== "undefined")
1244+
error += err.name+":";
1245+
if(typeof err.message !== "undefined")
1246+
error += err.message+"\n";
1247+
if(typeof err.fileName !== "undefined")
1248+
error += "in "+err.fileName+"\n";
1249+
if(typeof err.lineNumber !== "undefined")
1250+
error += "on "+err.lineNumber;
1251+
if(typeof err.columnNumber !== "undefined")
1252+
error += ":"+err.columnNumber;
1253+
}
1254+
}
12411255
else{
1242-
if(typeof err.name !== "undefined")
1243-
error += err.name+":";
1244-
if(typeof err.message !== "undefined")
1245-
error += err.message+"\n";
1246-
if(typeof err.fileName !== "undefined")
1247-
error += "in "+err.fileName+"\n";
1248-
if(typeof err.lineNumber !== "undefined")
1249-
error += "on "+err.lineNumber;
1250-
if(typeof err.columnNumber !== "undefined")
1251-
error += ":"+err.columnNumber;
1256+
error = err+"";
12521257
}
1258+
nonfatal = (nonfatal) ? true : false;
1259+
var metrics = getMetrics();
1260+
var ob = {_resolution:metrics._resolution, _error:error, _app_version:metrics._app_version, _run:getTimestamp()-startTime};
1261+
1262+
ob._not_os_specific = true;
1263+
1264+
var battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery || navigator.msBattery;
1265+
if (battery)
1266+
ob._bat = Math.floor(battery.level * 100);
1267+
1268+
if(typeof navigator.onLine !== 'undefined')
1269+
ob._online = (navigator.onLine) ? true : false;
1270+
1271+
ob._background = (document.hasFocus()) ? false : true;
1272+
1273+
if(crashLogs.length > 0)
1274+
ob._logs = crashLogs.join("\n");
1275+
crashLogs = [];
1276+
ob._nonfatal = nonfatal;
1277+
1278+
ob._view = (window.location.pathname || "")+(window.location.search || "")+(window.location.hash || "");
1279+
1280+
if(typeof segments !== "undefined")
1281+
ob._custom = segments;
1282+
1283+
try{
1284+
var canvas = document.createElement("canvas");
1285+
var gl = canvas.getContext("experimental-webgl");
1286+
ob._opengl = gl.getParameter(gl.VERSION);
1287+
}
1288+
catch(ex){}
1289+
1290+
toRequestQueue({crash: JSON.stringify(ob)});
12531291
}
1254-
else{
1255-
error = err+"";
1256-
}
1257-
nonfatal = (nonfatal) ? true : false;
1258-
var metrics = getMetrics();
1259-
var ob = {_resolution:metrics._resolution, _error:error, _app_version:metrics._app_version, _run:getTimestamp()-startTime};
1260-
1261-
ob._not_os_specific = true;
1262-
1263-
var battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery || navigator.msBattery;
1264-
if (battery)
1265-
ob._bat = Math.floor(battery.level * 100);
1266-
1267-
if(typeof navigator.onLine !== 'undefined')
1268-
ob._online = (navigator.onLine) ? true : false;
1269-
1270-
ob._background = (document.hasFocus()) ? false : true;
1271-
1272-
if(crashLogs.length > 0)
1273-
ob._logs = crashLogs.join("\n");
1274-
crashLogs = [];
1275-
ob._nonfatal = nonfatal;
1276-
1277-
ob._view = (window.location.pathname || "")+(window.location.search || "")+(window.location.hash || "");
1278-
1279-
if(typeof segments !== "undefined")
1280-
ob._custom = segments;
1281-
1282-
try{
1283-
var canvas = document.createElement("canvas");
1284-
var gl = canvas.getContext("experimental-webgl");
1285-
ob._opengl = gl.getParameter(gl.VERSION);
1286-
}
1287-
catch(ex){}
1288-
1289-
toRequestQueue({crash: JSON.stringify(ob)});
12901292
}
12911293

12921294
//sending xml HTTP request

0 commit comments

Comments
 (0)