package/lib/raygun.esm.js
/**
     * Computes stack trace information from the stack property.
     * Chrome and Gecko use this property.
     * Added WinJS regex for Raygun4JS's offline caching support
     * Added stack string sanitization for React Native in release mode, for JavaScriptCore, which uses the Gecko regex
     * @param {Error} ex
     * @return {?Object.<string, *>} Stack trace information.
     */
Computes stack trace information from the stack property.
Chrome and Gecko use this property.
Added WinJS regex for Raygun4JS's offline caching support
Added stack string sanitization for React Native in release mode, for JavaScriptCore, which uses the Gecko regex
@param {Error} ex
@return {?Object.} Stack trace information.
Computes stack trace information from the stack property . Chrome and Gecko use this property . Added WinJS regex for Raygun4JS ' s offline caching support Added stack string sanitization for React Native in release mode for JavaScriptCore which uses the Gecko regex @param { Error } ex @return { ?Object . } Stack trace information .
function computeStackTraceFromStackProp(ex) {
        var parseError;
        if (!ex.stack) {
            return null;
        }
        var chrome = /^\s*at (.*?) ?\(((?:file|https?|\s*|blob|chrome-extension|native|webpack|ionic|app|eval|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,
            gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|ionic|app|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,
            winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
            lines = ex.stack.split('\n'),
            stack = [],
            parts,
            element,
            reference = /^(.*) is undefined$/.exec(ex.message);
        if (Raygun.Utilities.isReactNative()) {
            var reactNativeDevicePathStripRegex = /^(.*@)?.*\/[^\.]+(\.app|CodePush)\/?(.*)/;
            var sourcemapPrefix = 'file://reactnative.local/';
            for (var i = 0; i < lines.length; i++) {
                parts = reactNativeDevicePathStripRegex.exec(lines[i]);
                if (parts !== null) {
                    var functionName = parts[1] ? parts[1] : 'anonymous@';
                    var filenameLineNumAndColumnNum = parts[3];
                    lines[i] = functionName + sourcemapPrefix + filenameLineNumAndColumnNum;
                }
            }
        }
        for (var i = 0, j = lines.length; i < j; ++i) {
            if ((parts = gecko.exec(lines[i]))) {
                element = {
                    'url': parts[3],
                    'func': parts[1] || UNKNOWN_FUNCTION,
                    'args': parts[2] ? parts[2].split(',') : '',
                    'line': +parts[4],
                    'column': parts[5] ? +parts[5] : null
                };
            } else if ((parts = chrome.exec(lines[i]))) {
                element = {
                    'url': parts[2],
                    'func': parts[1] || UNKNOWN_FUNCTION,
                    'line': +parts[3],
                    'column': parts[4] ? +parts[4] : null
                };
            } else if ((parts = winjs.exec(lines[i]))) {
                element = {
                    'url': parts[2],
                    'func': parts[1] || UNKNOWN_FUNCTION,
                    'line': +parts[3],
                    'column': parts[4] ? +parts[4] : null
                };
            } else {
                continue;
            }
            if (!element.func && element.line) {
                element.func = guessFunctionName(element.url, element.line);
            }
            if (typeof document !== 'undefined' && element.line) {
                element.context = gatherContext(element.url, element.line);
            }
            stack.push(element);
        }
        if (stack[0] && stack[0].line && !stack[0].column && reference) {
            stack[0].column = findSourceInLine(reference[1], stack[0].url, stack[0].line);
        } else if (!stack[0].column && typeof ex.columnNumber !== 'undefined') {
            stack[0].column = ex.columnNumber + 1;
        }
        if (!stack.length) {
            return null;
        }
        var res = {
            'mode': 'stack',
            'name': ex ? ex.name : '',
            'message': ex ? ex.message : '',
            'url': typeof document !== 'undefined' ? document.location.href : '',
            'stack': stack,
            'useragent': navigator ? navigator.userAgent : '',
            'stackstring': ex && ex.stack ? ex.stack.toString() : ''
        };
        return res;
    }
function computeStackTraceFromStackProp ( ex ) { var parseError ; if ( ! ex . stack ) { return null ; } var chrome = / ^\s*at (.*?) ?\(((?:file|https?|\s*|blob|chrome-extension|native|webpack|ionic|app|eval|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$ / i , gecko = / ^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|ionic|app|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$ / i , winjs = / ^\s*at (?:((?:\[object object\])?.+) )?\(?((?:ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$ / i , lines = ex . stack . split ( '\n' ) , stack = [ ] , parts , element , reference = / ^(.*) is undefined$ / . exec ( ex . message ) ; if ( Raygun . Utilities . isReactNative ( ) ) { var reactNativeDevicePathStripRegex = / ^(.*@)?.*\/[^\.]+(\.app|CodePush)\/?(.*) / ; var sourcemapPrefix = 'file://reactnative.local/' ; for ( var i = 0 ; i < lines . length ; i ++ ) { parts = reactNativeDevicePathStripRegex . exec ( lines [ i ] ) ; if ( parts !== null ) { var functionName = parts [ 1 ] ? parts [ 1 ] : 'anonymous@' ; var filenameLineNumAndColumnNum = parts [ 3 ] ; lines [ i ] = functionName + sourcemapPrefix + filenameLineNumAndColumnNum ; } } } for ( var i = 0 , j = lines . length ; i < j ; ++ i ) { if ( ( parts = gecko . exec ( lines [ i ] ) ) ) { element = { 'url' : parts [ 3 ] , 'func' : parts [ 1 ] || UNKNOWN_FUNCTION , 'args' : parts [ 2 ] ? parts [ 2 ] . split ( ',' ) : '' , 'line' : + parts [ 4 ] , 'column' : parts [ 5 ] ? + parts [ 5 ] : null } ; } else if ( ( parts = chrome . exec ( lines [ i ] ) ) ) { element = { 'url' : parts [ 2 ] , 'func' : parts [ 1 ] || UNKNOWN_FUNCTION , 'line' : + parts [ 3 ] , 'column' : parts [ 4 ] ? + parts [ 4 ] : null } ; } else if ( ( parts = winjs . exec ( lines [ i ] ) ) ) { element = { 'url' : parts [ 2 ] , 'func' : parts [ 1 ] || UNKNOWN_FUNCTION , 'line' : + parts [ 3 ] , 'column' : parts [ 4 ] ? + parts [ 4 ] : null } ; } else { continue ; } if ( ! element . func && element . line ) { element . func = guessFunctionName ( element . url , element . line ) ; } if ( typeof document !== 'undefined' && element . line ) { element . context = gatherContext ( element . url , element . line ) ; } stack . push ( element ) ; } if ( stack [ 0 ] && stack [ 0 ] . line && ! stack [ 0 ] . column && reference ) { stack [ 0 ] . column = findSourceInLine ( reference [ 1 ] , stack [ 0 ] . url , stack [ 0 ] . line ) ; } else if ( ! stack [ 0 ] . column && typeof ex . columnNumber !== 'undefined' ) { stack [ 0 ] . column = ex . columnNumber + 1 ; } if ( ! stack . length ) { return null ; } var res = { 'mode' : 'stack' , 'name' : ex ? ex . name : '' , 'message' : ex ? ex . message : '' , 'url' : typeof document !== 'undefined' ? document . location . href : '' , 'stack' : stack , 'useragent' : navigator ? navigator . userAgent : '' , 'stackstring' : ex && ex . stack ? ex . stack . toString ( ) : '' } ; return res ; }
Computes stack trace information from the stack property.
Computes stack trace information from the stack property .
// Firefox column number