Skip to content

Commit

Permalink
Merge pull request #341 from Microsoft/AiStorageTelemetry
Browse files Browse the repository at this point in the history
Don't log session storage errors
  • Loading branch information
Kamil Szostak committed Nov 4, 2016
2 parents d396080 + bcebcaa commit 92c2e6c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions JavaScript/JavaScriptSDK/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ module Microsoft.ApplicationInsights {
try {
return storage.getItem(name);
} catch (e) {
Util._canUseLocalStorage = false;

var message = new _InternalLogMessage(
_InternalMessageId.NONUSRACT_BrowserCannotReadLocalStorage,
"Browser failed read of local storage. " + Util.getExceptionName(e),
Expand All @@ -112,6 +114,8 @@ module Microsoft.ApplicationInsights {
storage.setItem(name, data);
return true;
} catch (e) {
Util._canUseLocalStorage = false;

var message = new _InternalLogMessage(
_InternalMessageId.NONUSRACT_BrowserCannotWriteLocalStorage,
"Browser failed write to local storage. " + Util.getExceptionName(e),
Expand All @@ -136,6 +140,8 @@ module Microsoft.ApplicationInsights {
storage.removeItem(name);
return true;
} catch (e) {
Util._canUseLocalStorage = false;

var message = new _InternalLogMessage(
_InternalMessageId.NONUSRACT_BrowserFailedRemovalFromLocalStorage,
"Browser failed removal of local storage item. " + Util.getExceptionName(e),
Expand Down Expand Up @@ -200,12 +206,14 @@ module Microsoft.ApplicationInsights {
try {
return storage.getItem(name);
} catch (e) {
Util._canUseSessionStorage = false;

var message = new _InternalLogMessage(
_InternalMessageId.NONUSRACT_BrowserCannotReadSessionStorage,
"Browser failed read of session storage. " + Util.getExceptionName(e),
{ exception: Util.dump(e) }
);
_InternalLogging.throwInternalNonUserActionable(LoggingSeverity.CRITICAL, message);
_InternalLogging.throwInternalNonUserActionable(LoggingSeverity.WARNING, message);
}
}
return null;
Expand All @@ -225,12 +233,14 @@ module Microsoft.ApplicationInsights {
storage.setItem(name, data);
return true;
} catch (e) {
Util._canUseSessionStorage = false;

var message = new _InternalLogMessage(
_InternalMessageId.NONUSRACT_BrowserCannotWriteSessionStorage,
"Browser failed write to session storage. " + Util.getExceptionName(e),
{ exception: Util.dump(e) }
);
_InternalLogging.throwInternalNonUserActionable(LoggingSeverity.CRITICAL, message);
_InternalLogging.throwInternalNonUserActionable(LoggingSeverity.WARNING, message);
}
}
return false;
Expand All @@ -249,12 +259,14 @@ module Microsoft.ApplicationInsights {
storage.removeItem(name);
return true;
} catch (e) {
Util._canUseSessionStorage = false;

var message = new _InternalLogMessage(
_InternalMessageId.NONUSRACT_BrowserFailedRemovalFromSessionStorage,
"Browser failed removal of session storage item. " + Util.getExceptionName(e),
{ exception: Util.dump(e) }
);
_InternalLogging.throwInternalNonUserActionable(LoggingSeverity.CRITICAL, message);
_InternalLogging.throwInternalNonUserActionable(LoggingSeverity.WARNING, message);
}
}
return false;
Expand Down

0 comments on commit 92c2e6c

Please sign in to comment.