Produces a nicely formatted error message by supplying the
stack frame information from two levels up and OUTSIDE of
HTMLPurifier_Config.
777391
protected function triggerError($msg, $no) {
        // determine previous stack frame
        $backtrace = debug_backtrace();
        if ($this->chatty && isset($backtrace[1])) {
            $frame = $backtrace[1];
            $extra = " on line {$frame['line']} in file {$frame['file']}";
        } else {
            $extra = '';
        }
        trigger_error($msg . $extra, $no);
    }
1082020
function _Error() {
    this.populate.apply(this, arguments);
    var stack = (new Error(this.message)).stack;
    debug('stack ', stack);
}
1210256
function _formatErrorsWarnings(level, list, projectRoot){
    return list.map(x => {
        let file, line, col, endLine, endCol, message
        try{
            // resolve  the relative path 
            let fullFilePath = data_get(x, 'module.resource')
            file = fullFilePath && projectRoot ? path.relative(projectRoot, fullFilePath) : ''
            // file = file.replace(/[\\//]/g, '/')

            line = data_get(x, 'error.error.loc.line') || 0
            col = data_get(x, 'error.error.loc.column') || 0

            // only need first line of message
            let fullMessage = (x.message + '').trim()
            let crPos = fullMessage.indexOf("\n")
            if (crPos >= 0){
                message = fullMessage.substring(0, crPos)
            } else {
                message = fullMessage
            }

            if (!line){
                let linesColsInfo
                let m
                if (x.name === 'ModuleNotFoundError'
                    && (m = fullMessage.match(MODULE_NOT_FOUND_ERR_MSG_PATTERN))){
                    linesColsInfo = _resolveLineColNumInFile(fullFilePath, m[1])
                } else if (fullMessage.indexOf('component lists rendered with v-for should have explicit keys') > 0
                    && (m = fullMessage.match(/([a-zA-Z-_]+)\s+(v-for=['"].*?['"])/))){
                    linesColsInfo = _resolveLineColNumInFile(fullFilePath, m[2], {after: m[1]})
                } else if (m = fullMessage.match(/export ['"](\S+?)['"] was not found/)){
                    linesColsInfo = _resolveLineColNumInFile(fullFilePath, m[1], {after: 'import'})
                } else if (m = fullMessage.match(/Error compiling template:((?:.|[\r\n])*)- Component template/m)){
                    linesColsInfo = _resolveLineColNumInFile(fullFilePath, m[1].trim())
                    message = fullMessage.replace(/\n/g, ' ')
                }

                if (linesColsInfo){
                    line = linesColsInfo.line || 0
                    col = linesColsInfo.col || 0
                    endLine = linesColsInfo.endLine
                    endCol = linesColsInfo.endCol
                }
            }

            let endLinesCols = (endLine || endCol) ? ('~' + (endLine || '') + (endLine ? ',' : '') + (endCol || '0')) : ''

            return `!>${level}: ${file}:${line},${col}${endLinesCols}: ${message || '@see output window'}`            
        } catch (e){
            console.warn(e)
            return ''
        }
    }).join("\n")
}
22862
def call_and_catch_errors(self, f, *args, **kwargs):
        
        try:
            return f(*args, **kwargs)
        except SassError as e:
            if self.live_errors:
                # TODO should this setting also capture and display warnings?
                return e.to_css()
            else:
                raise
601588
def _surpress_formatting_errors(fn):
    
    @wraps(fn)
    def inner(*args, **kwargs):
        try:
            return fn(*args, **kwargs)
        except ValueError:
            return ""
    return inner
1270852
def _http_error_handler(http_error):
    ''' '''
    message = str(http_error)
    error_code = None

    if 'x-ms-error-code' in http_error.respheader:
        error_code = http_error.respheader['x-ms-error-code']
        message += ' ErrorCode: ' + error_code

    if http_error.respbody is not None:
        message += '\n' + http_error.respbody.decode('utf-8-sig')

    ex = AzureHttpError(message, http_error.status)
    ex.error_code = error_code

    raise ex
1163367
private void handleErrorCode() {
		String msg = I18nUtilities
				.format(UIContextHolder.getCurrent().getLocale(),
						InternalMessages.DEFAULT_STEP_ERROR);
		throw new ErrorCodeEscape(HttpServletResponse.SC_BAD_REQUEST, msg);
	}
794173
function normalizeError(err) {
  let message = 'Unknown error';

  if (err) {
    if (err instanceof Error) {
      return err;
    }

    message = err.stack || err.message || err;
  }

  return new Error(message);
}
1164533
function formatError(err, options) {
    options = options || {};
    var name = err.name || err.constructor.name;
    var str = util.format('%s: %s\n', name, err.message);
    if (err.buffer && err.buffer.hexdump) {
        str += err.buffer.hexdump({
            colored: options.color,
            boldStart: false,
            highlight: options.color ? errorHighlighter(err, options) : null
        });
    } else if (Buffer.isBuffer(err.buffer)) {
        if (options.color) {
            str += formatBufferColored(err, options);
        } else {
            str += formatBufferUncolored(err, options);
        }
    }
    return str;
}
24115
function errorDialog(text, err) {
    var msg = err && err.message ?
      err.message.split(/\r?\n/)[0] :
      typeof err === "string" ?
        err.split(/\r?\n/)[0] :
        JSON.stringify(err);
    return window.alert(text+ ':\n' + msg);
  }
916184
private static function catchError()
    {
        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                self::$error = false;
                break;
            case JSON_ERROR_DEPTH:
                self::$error = 'Maximum stack depth exceeded';
                break;
            case JSON_ERROR_STATE_MISMATCH:
                self::$error = 'Underflow or the modes mismatch';
                break;
            case JSON_ERROR_CTRL_CHAR:
                self::$error = 'Unexpected control character found';
                break;
            case JSON_ERROR_SYNTAX:
                self::$error = 'Syntax error, malformed JSON';
                break;
            case JSON_ERROR_UTF8:
                self::$error = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                break;
            default:
                self::$error = 'Unknown error';
                break;
        }
    }
1225807
def raise_option_error(parser, option, msg):
    
    msg = '{} error: {}'.format(option, msg)
    msg = textwrap.fill(' '.join(msg.split()))
    parser.error(msg)
830832
function encodeError(err, header) {
  return Buffer.concat([
    header || new Buffer([0]), // Recover the header if possible.
    new Buffer([1, 0]), // Error flag and first union index.
    STRING_TYPE.toBuffer(err.message)
  ]);
}
379343
function render_stack_trace(error, { markup_settings, log })
{
	// Supports custom `html` for an error
	if (error.html)
	{
		return { response_status: error.status, response_body: error.html }
	}

	// Handle `superagent` errors
	// https://github.com/visionmedia/superagent/blob/29ca1fc938b974c6623d9040a044e39dfb272fed/lib/node/response.js#L106
	if (error.response && typeof error.status === 'number')
	{
		// If the `superagent` http request returned an HTML response 
		// (possibly an error stack trace),
		// then just output that stack trace.
		if (error.response.headers['content-type']
			&& error.response.headers['content-type'].split(';')[0].trim() === 'text/html')
		{
			return { response_status: error.status, response_body: error.message }
		}
	}

	// If this error has a stack trace then it can be shown

	let stack_trace

	if (error.stack)
	{
		stack_trace = error.stack
	}
	// `superagent` errors have the `original` property 
	// for storing the initial error
	else if (error.original && error.original.stack)
	{
		stack_trace = error.original.stack
	}

	// If this error doesn't have a stack trace - do nothing
	if (!stack_trace)
	{
		return {}
	}

	// Render the error's stack trace as HTML markup
	try
	{
		return { response_body: html_stack_trace({ stack: stack_trace }, markup_settings) }
	}
	catch (error)
	{
		log.error(error)

		// If error stack trace couldn't be rendered as HTML markup,
		// then just output it as plain text.
		return { response_body: error.stack }
	}
}
1004029
function formatMessage(message) {
  let lines = message.split('\n');

  // Remove webpack-specific loader notation from filename.
  // Before:
  // ./~/css-loader!./~/postcss-loader!./src/App.css
  // After:
  // ./src/App.css
  if (lines[0].lastIndexOf('!') !== -1) {
    lines[0] = lines[0].substr(lines[0].lastIndexOf('!') + 1);
  }

  // line #0 is filename
  // line #1 is the main error message
  if (!lines[0] || !lines[1]) {
    return lines.join('\n');
  }

  // Cleans up verbose "module not found" messages for files and packages.
  if (lines[1].indexOf('Module not found: ') === 0) {
    lines = [
      lines[0],
      // Clean up message because "Module not found: " is descriptive enough.
      lines[1]
        .replace("Cannot resolve 'file' or 'directory' ", '')
        .replace('Cannot resolve module ', '')
        .replace('Error: ', ''),
      // Skip all irrelevant lines.
      // (For some reason they only appear on the client in browser.)
      '',
      lines[lines.length - 1] // error location is the last line
    ];
  }

  // Cleans up syntax error messages.
  if (lines[1].indexOf('Module build failed: ') === 0) {
    const cleanedLines = [];
    lines.forEach(line => {
      if (line !== '') {
        cleanedLines.push(line);
      }
    });
    // We are clean now!
    lines = cleanedLines;
    // Finally, brush up the error message a little.
    lines[1] = lines[1].replace('Module build failed: SyntaxError:', friendlySyntaxErrorLabel);
  }

  // Reassemble the message.
  message = lines.join('\n');
  // Internal stacks are generally useless so we strip them... with the
  // exception of stacks containing `webpack:` because they're normally
  // from user code generated by WebPack. For more information see
  // https://github.com/facebookincubator/create-react-app/pull/1050
  message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y

  return message;
}
860641
function handleError(err, getContext, lax) {

    var ctx = getContext();

    var line = ctx.line,
        column = ctx.column,
        data = ctx.data;

    // we receive the full context data here,
    // for elements trim down the information
    // to the tag name, only
    if (data.charAt(0) === '<' && data.indexOf(' ') !== -1) {
      data = data.slice(0, data.indexOf(' ')) + '>';
    }

    var message =
      'unparsable content ' + (data ? data + ' ' : '') + 'detected\n\t' +
        'line: ' + line + '\n\t' +
        'column: ' + column + '\n\t' +
        'nested error: ' + err.message;

    if (lax) {
      context.addWarning({
        message: message,
        error: err
      });

      return true;
    } else {
      throw error(message);
    }
  }
994102
function formatMessage (message) {
  return '<error' +
    attr(message, 'line') +
    attr(message, 'column') +
    attr(message, 'severity') +
    attr(message, 'message') +
    ('source' in message ? attr(message, 'source') : '') +
    ' />'
}