src/plugins/noderError/evalError.js
function formatError(err, input) {
    var msg = err.message.replace(/\s*\(\d*\:\d*\)\s*$/i, ''); // remove line number / col number

    var bm = ('' + input.slice(0, err.pos)).match(/.*$/i);
    var am = ('' + input.slice(err.pos)).match(/.*/i);
    var before = bm ? bm[0] : '';
    var after = am ? am[0] : '';

    // Prepare line info for txt display
    var cursorPos = before.length;
    var lineStr = before + after;
    var lncursor = [];
    for (var i = 0, sz = lineStr.length; sz > i; i++) {
        lncursor[i] = (i === cursorPos) ? '\u005E' : '-';
    }
    var lineInfoTxt = lineStr + '\n' + lncursor.join('');

    return {
        description: msg,
        lineInfoTxt: lineInfoTxt,
        code: lineStr,
        line: err.loc ? err.loc.line : -1,
        column: err.loc ? err.loc.column : -1
    };
}
function formatError(err, input) {
    var msg = err.message.replace(/\s*\(\d*\:\d*\)\s*$/i, ''); // remove line number / col number

    var bm = ('' + input.slice(0, err.pos)).match(/.*$/i);
    var am = ('' + input.slice(err.pos)).match(/.*/i);
    var before = bm ? bm[0] : '';
    var after = am ? am[0] : '';

    // Prepare line info for txt display
    var cursorPos = before.length;
    var lineStr = before + after;
    var lncursor = [];
    for (var i = 0, sz = lineStr.length; sz > i; i++) {
        lncursor[i] = (i === cursorPos) ? '\u005E' : '-';
    }
    var lineInfoTxt = lineStr + '\n' + lncursor.join('');

    return {
        description: msg,
        lineInfoTxt: lineInfoTxt,
        code: lineStr,
        line: err.loc ? err.loc.line : -1,
        column: err.loc ? err.loc.column : -1
    };
}
function formatError ( err , input ) { var msg = err . message . replace ( / \s*\(\d*\:\d*\)\s*$ / i , '' ) ; // remove line number / col number var bm = ( '' + input . slice ( 0 , err . pos ) ) . match ( / .*$ / i ) ; var am = ( '' + input . slice ( err . pos ) ) . match ( / .* / i ) ; var before = bm ? bm [ 0 ] : '' ; var after = am ? am [ 0 ] : '' ; // Prepare line info for txt display var cursorPos = before . length ; var lineStr = before + after ; var lncursor = [ ] ; for ( var i = 0 , sz = lineStr . length ; sz > i ; i ++ ) { lncursor [ i ] = ( i === cursorPos ) ? '\u005E' : '-' ; } var lineInfoTxt = lineStr + '\n' + lncursor . join ( '' ) ; return { description : msg , lineInfoTxt : lineInfoTxt , code : lineStr , line : err . loc ? err . loc . line : - 1 , column : err . loc ? err . loc . column : - 1 } ; }
Format the error as an error structure with line extract information
Format the error as an error structure with line extract information