Skip to content

Commit

Permalink
Guard console statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Markionium committed Oct 22, 2015
1 parent a4d471b commit 36c600a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/main/datasets/datasetview-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ function datasetViewDirective(AppManifest, $translate) {
}
}
} catch (e) {
window.console.error(e);
if (window.console && window.console.error) {
window.console.error(e);
}
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/main/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ <h1 ng-bind="app.title">Data approval</h1>
if (dhis2CoreScripts.length > 0) {
script = dhis2CoreScripts.shift();

console.log('Loading: ' + dhis2Root + script);
window.console && console.log('Loading: ' + dhis2Root + script);

jQuery.getScript(dhis2Root + script, function () {
loadScript(callBack);
Expand All @@ -175,7 +175,7 @@ <h1 ng-bind="app.title">Data approval</h1>

dhis2Root = manifest.activities.dhis.href;
if (!dhis2Root) {
console.error('Error trying to get the dhis2 url from the manifest');
window.console && console.error('Error trying to get the dhis2 url from the manifest');
}

window.dhis2 = window.dhis2 || {};
Expand Down Expand Up @@ -211,7 +211,7 @@ <h1 ng-bind="app.title">Data approval</h1>
setTimeout(bootstrapApp, 0);
})
.fail(function () {
console.warn('Failed to load uiLocale from userSettings: defaulting to english');
window.console && console.warn('Failed to load uiLocale from userSettings: defaulting to english');
configureApp('en');

setTimeout(bootstrapApp, 0);
Expand Down

0 comments on commit 36c600a

Please sign in to comment.