Skip to content

Commit ca093a6

Browse files
committed
log messages with a try catch to support ie 8
1 parent f404d91 commit ca093a6

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Unreleased
22

33
* Fix bug where saveReferrer throws exception if sessionStorage is disabled.
4+
* Log messages with a try/catch to support IE 8.
45

56
## 2.9.0 (January 15, 2016)
67

amplitude.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ var Identify = require('./identify');
118118
var type = require('./type');
119119

120120
var log = function(s) {
121-
console.log('[Amplitude] ' + s);
121+
try {
122+
console.log('[Amplitude] ' + s);
123+
} catch (e) {
124+
// console logging not available
125+
}
122126
};
123127

124128
var IDENTIFY_EVENT = '$identify';
@@ -3542,7 +3546,11 @@ var AMP_OP_SET_ONCE = '$setOnce';
35423546
var AMP_OP_UNSET = '$unset';
35433547

35443548
var log = function(s) {
3545-
console.log('[Amplitude] ' + s);
3549+
try {
3550+
console.log('[Amplitude] ' + s);
3551+
} catch (e) {
3552+
// console logging not available
3553+
}
35463554
};
35473555

35483556
var Identify = function() {

amplitude.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/amplitude.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ var Identify = require('./identify');
1212
var type = require('./type');
1313

1414
var log = function(s) {
15-
console.log('[Amplitude] ' + s);
15+
try {
16+
console.log('[Amplitude] ' + s);
17+
} catch (e) {
18+
// console logging not available
19+
}
1620
};
1721

1822
var IDENTIFY_EVENT = '$identify';

src/identify.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ var AMP_OP_SET_ONCE = '$setOnce';
1414
var AMP_OP_UNSET = '$unset';
1515

1616
var log = function(s) {
17-
console.log('[Amplitude] ' + s);
17+
try {
18+
console.log('[Amplitude] ' + s);
19+
} catch (e) {
20+
// console logging not available
21+
}
1822
};
1923

2024
var Identify = function() {

0 commit comments

Comments
 (0)