This function render an error message with a possible custom payload.
182531
def core__send_request_fail(error, payload: nil)
      response = { result: false, error_message: error }
      response[:payload] = payload if payload
      render json: response
    end
1034800
function emitBadMessageError (message) {
    var error = new Error('invalid message')
    error.message = message
    client.emit('error', error)
  }
719577
def error(self, request, message, extra_tags='', fail_silently=False):
        """"""
        add(self.target_name, request, constants.ERROR, message, extra_tags=extra_tags,
            fail_silently=fail_silently)
861369
function errorWrap(err, param, sent) {
  if (err instanceof restify.RestError) {
    err.body.parameter = param
    err.body.received = sent
  }
  return err
}
136563
def generate_error_message(tag, err_uniq, err_appl, err_mult):
    
    err = []
    if err_uniq:
        err.append('Uniqueness restriction: item type %s' % tag.item_type)
    if err_appl:
        err.append('Applicability restriction: field %s' % tag.field)
    if err_mult:
        err.append('Multiplicity restriction: field %s' % tag.field)
    return err
81920
protected function renderError() {	
	    $error = I18N::translate('The media file was not found in this family tree.');

    	$width  = (mb_strlen($error) * 6.5 + 50) * 1.15;
    	$height = 60;
    	$im     = imagecreatetruecolor($width, $height); /* Create a black image */
    	$bgc    = imagecolorallocate($im, 255, 255, 255); /* set background color */
    	imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */
    
    	$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
    
    	http_response_code(404);
    	header('Content-Type: image/png');
    	imagepng($im);
    	imagedestroy($im);
	}
517748
def _message_to_payload(cls, message):
        ''''''
        try:
            return json.loads(message.decode())
        except UnicodeDecodeError:
            message = 'messages must be encoded in UTF-8'
        except json.JSONDecodeError:
            message = 'invalid JSON'
        raise cls._error(cls.PARSE_ERROR, message, True, None)
952302
function wrapError(message, cause) {
  var err = new Error(f('%s: %s', message, cause.message));
  err.cause = cause;
  return err;
}
1184342
public function renderErrors($errors)
    {
        if (empty($errors)) {
            return null;
        }

        $message = '';

        foreach ($errors as &$error) {
            foreach ($error as $errorCode => &$errorMsg) {
                $message .= $this->errorMapper($errorCode, $errorMsg);
            }
        }

        return $message;
    }
319128
def error(request, message, extra_tags='', fail_silently=False, async=False):
    """"""
    if ASYNC and async:
        messages.debug(_get_user(request), message)
    else:
        add_message(request, constants.ERROR, message, extra_tags=extra_tags,
                    fail_silently=fail_silently)
1360198
def _error(self, message, start, end=None):
        """"""
        raise errors.EfilterParseError(
            source=self.source, start=start, end=end, message=message)
566704
function error (message, error) {
    // get model name
    var modelName = defined(this) && defined(this.name) ? this.name : 'ImmutableCoreModel'
    // build custom error message
    message = `${modelName} error` + (
        typeof message === 'string'
            ? `: ${message}`
            : ''
    )
    // use error object passed in
    if (defined(error)) {
        // create data object with original message
        error.data = {
            error: {
                code: error.code,
                message: error.message,
            },
        }
    }
    // create new error message
    else {
        error = new Error(message)
        error.data = {}
    }

    return error
}
34262
function logMessage (message, data) {
  if (!message) return
  render(message, data, (err, res) => {
    if (err) {
      console.error('\n   Error when rendering template complete message: ' + err.message.trim())
    }
    else {
      console.log('\n' + res.split(/\r?\n/g).map(line => '   ' + line).join('\n'))
    }
  })
}
1046191
function createErrorHandler(opts, transform) {
  return err => {
    if ('emit' === opts.error) {
      transform.emit('error', err)
    }
    else if ('function' === typeof opts.error) {
      opts.error(err)
    }
    else {
      const message = colors.red(err.name) + '\n' + err.toString()
        .replace(/(ParseError.*)/, colors.red('$1'))
      log(message)
    }

    transform.emit('end')

    if (opts.callback) {
      opts.callback(through2())
    }
  }
}
1035445
def render_field_error(self, obj_id, obj, exception, request):
        
        if obj is None:
            msg = 'No match for ID={0}'.format(obj_id)
        else:
            msg = unicode(exception)
        return u'<p class="error">{0}</p>'.format(msg)
927993
def render_error(request, exc):
    ''''''
    cfg = request.get('pulsar.cfg')
    debug = cfg.debug if cfg else False
    response = request.response
    if not response.content_type:
        content_type = request.get('default.content_type')
        response.content_type = request.content_types.best_match(
            as_tuple(content_type or DEFAULT_RESPONSE_CONTENT_TYPES)
        )
    content_type = None
    if response.content_type:
        content_type = response.content_type.split(';')[0]
    is_html = content_type == 'text/html'

    if debug:
        msg = render_error_debug(request, exc, is_html)
    else:
        msg = escape(error_messages.get(response.status_code) or exc)
        if is_html:
            msg = textwrap.dedent("""
                <h1>{0[reason]}</h1>
                {0[msg]}
                <h3>{0[version]}</h3>
            """).format({"reason": response.status, "msg": msg,
                         "version": request.environ['SERVER_SOFTWARE']})
    #
    if content_type == 'text/html':
        doc = HtmlDocument(title=response.status)
        doc.head.embedded_css.append(error_css)
        doc.body.append(Html('div', msg, cn='pulsar-error'))
        return doc.to_bytes(request)
    elif content_type in JSON_CONTENT_TYPES:
        return json.dumps({'status': response.status_code,
                           'message': msg})
    else:
        return '\n'.join(msg) if isinstance(msg, (list, tuple)) else msg
1120777
protected function reportErrorPayload()
  {

    $errorPayload = $this->message;
    unset($errorPayload['payload']);
    unset($errorPayload['original']);
    echo '-> message: ' . print_r($errorPayload, true), PHP_EOL;
    $this->statHat->ezCount('MB_Toolbox: MB_Toolbox_BaseConsumer: reportErrorPayload', 1);
  }