Skip to Content

geoErrorCallback()

Stored geolocation error information when they occur.

JavaScript February 22, 2017

Usage

This function runs automatically, so it is not called manually. Is this incorrect?

Source File

Located in /assets/js/nebula.js on line 3320.

JavaScript
function geoErrorCallback(error){
    switch (error.code){
        case error.PERMISSION_DENIED:
            var geolocationErrorMessage = 'Access to your location is turned off. Change your settings to report location data.';
            var geoErrorNote = 'Denied';
            break;
        case error.POSITION_UNAVAILABLE:
            var geolocationErrorMessage = "Data from location services is currently unavailable.";
            var geoErrorNote = 'Unavailable';
            break;
        case error.TIMEOUT:
            var geolocationErrorMessage = "Location could not be determined within a specified timeout period.";
            var geoErrorNote = 'Timeout';
            break;
        default:
            var geolocationErrorMessage = "An unknown error has occurred.";
            var geoErrorNote = 'Error';
            break;
    }

    nebula.session.geolocation = {
        error: {
            code: error.code,
            description: geolocationErrorMessage
        }
    };

    nebula.dom.document.trigger('geolocationError');
    nebula.dom.body.addClass('geo-error');
    ga('set', nebula.analytics.dimensions.geolocation, geolocationErrorMessage);
    ga('send', 'exception', {'exDescription': '(JS) Geolocation error: ' + geolocationErrorMessage, 'exFatal': false});
    nebula.crm('event', 'Geolocation Error');
}

Override

To override or disable this JavaScript function, simply redeclare it with the exact same function name.

JavaScript
function geoErrorCallback(){
    //Write your own code here, leave it blank, or return false.
}