Create a message with details on the exception.
541749
def exception_message():
    """"""
    exc_type, exc_value, exc_tb = exc_info = sys.exc_info()
    return {'exception': {'type': exc_type,
                          'value': exc_value,
                          'traceback': exc_tb},
            'traceback': traceback.format_exception(*exc_info)}
975995
private Exception updateErrorMsg(StringBuilder pErrors, Exception exp) {
        pErrors.append(exp.getClass()).append(": ").append(exp.getMessage()).append("\n");
        return exp;
    }
479361
def process_exception_message(exception):
        
        exception_message = str(exception)
        for replace_char in ['\t', '\n', '\\n']:
            exception_message = exception_message.replace(replace_char, '' if replace_char != '\t' else ' ')
        return exception_message.replace('section', 'alias')
488602
def message(msg, indent=False, mtype='standard', caption=False):
    """"""
    if caption:
        msg = '\n' + msg + '\n' + '-'*len(msg) + '\n'
    if mtype == 'warning':
        msg = colorlog('Warning:  ' + msg, 'yellow')
    if mtype == 'error':
        msg = colorlog('Error:  ' + msg, 'red')
    if mtype == 'debug':
        msg = colorlog('Debug:  ' + msg, 'pink')
    if mtype == 'info':
        msg = colorlog('Info:  ' + msg, 'green')
    if indent:
        msg = '  ' + msg
    sys.stderr.write(msg)
548338
def log(message, severity="INFO", print_debug=True):
    

    print_me = ['WARNING', 'INFO', 'DEBUG']
    if severity in print_me:
        if severity == 'DEBUG':
            if print_debug:
                print("{0}: {1}".format(severity, message))
        else:
            print("{0}: {1}".format(severity, message))
    else:
        raise Exception("{0}: {1}".format(severity, message))
242977
def message_for_exception(exception: Exception, message: str) -> Sequence[Token]:
    
    tb = sys.exc_info()[2]
    buffer = io.StringIO()
    traceback.print_tb(tb, file=io)  # type: ignore
    # fmt: off
    return (
        red, message + "\n",
        exception.__class__.__name__,
        str(exception), "\n",
        reset, buffer.getvalue()
    )
109099
public static ValidationException info(String messageKey, 
			Object... params) {
		return new ValidationException(
				ValidationMessage.info(messageKey, params));		
	}
60283
public static String convertExceptionToMessage(Throwable ex)
  {
    StringBuilder sb = new StringBuilder();
    if(ex != null)
    {
      sb.append("Exception type: ").append(ex.getClass().getName()).append("\n");
      sb.append("Message: ").append(ex.getLocalizedMessage()).append("\n");
      sb.append("Stacktrace: \n");
      StackTraceElement[] st = ex.getStackTrace();
      for (int i = 0; i < st.length; i++)
      {
        sb.append(st[i].toString());
        sb.append("\n");
      }
    }
    return sb.toString();
  }
1175643
private String generateAbbreviatedExceptionMessage(final Throwable throwable) {

		final StringBuilder builder = new StringBuilder();
		builder.append(": ");
		builder.append(throwable.getClass().getCanonicalName());
		builder.append(": ");
		builder.append(throwable.getMessage());

		Throwable cause = throwable.getCause();
		while (cause != null) {
			builder.append('\n');
			builder.append("Caused by: ");
			builder.append(cause.getClass().getCanonicalName());
			builder.append(": ");
			builder.append(cause.getMessage());
			// make sure the exception cause is not itself to prevent infinite
			// looping
			assert (cause != cause.getCause());
			cause = (cause == cause.getCause() ? null : cause.getCause());
		}
		return builder.toString();
	}
694033
def _log_and_raise_exception(msg, data, cls=FoursquareException):
  """"""
  data = u'{0}'.format(data)
  # We put data as a argument for log.error() so error tracking systems such
  # as Sentry will properly group errors together by msg only
  log.error(u'{0}: %s'.format(msg), data)
  raise cls(u'{0}: {1}'.format(msg, data))
1198290
def exception(self, msg=None, *args, **kwargs):
        
        kwargs['exc_info'] = 1
        return self._log(logging.ERROR, msg, args, kwargs)
954043
def reformat_exception(cls, message, err, *format_args, **format_kwds):
        
        final_message = message.format(*format_args, **format_kwds)
        final_message = "{} -- {}: {}".format(
            final_message,
            type(err).__name__,
            str(err),
        )
        final_message = cls.sanitize_errstr(final_message)
        return final_message
803400
private String getExceptionMessage(Throwable pException) {
        String message = pException.getLocalizedMessage();
        return pException.getClass().getName() + (message != null ? " : " + message : "");
    }
980831
public static String getExceptionMessage(Exception e) {
        if (e.getCause() != null && e.getCause().getMessage() != null) {
            String s = getscard(e.getCause().getMessage());
            if (s != null)
                return s;
        }
        if (e.getMessage() != null) {
            String s = getscard(e.getMessage());
            if (s != null)
                return s;
        }
        return e.getMessage();
    }
230941
private function buildException()
    {
        if($this->isJsonRequest()){
            $this->setException(new ExceptionJson($this->message,$this->debugCode,$this->details,$this->errors));
        }else{
            $exception = new ExceptionView($this->message,$this->debugCode,$this->details,$this->errors);
            $exception->setViewPath($this->getVewPath());
            $exception->setRedirectPath($this->getRedirect());
            $this->setException($exception);
        }
    }
1136554
function Exception(message, innerException) {
  if (!message) {
    throw new Exception("Argument 'message' is required but was '" +
      (message === null ? "null" : "undefined") + "'");
  }
  if (typeof message !== 'string') {
    throw new Exception("Argument 'message' must be of type 'string' but was '" + typeof message + "'");
  }

  if (innerException === undefined && typeof message !== 'string') {
    innerException = message;
    message = innerException.message || innerException.toString();
  }

  this.message = message;
  this.innerException = innerException;
  this.toString = function () {
    return message;
  };
}
1245974
def send_exception(self):
        """"""
        self.compiler.reset()

        exc = traceback.format_exc()
        self.writer.write(exc.encode('utf8'))

        yield from self.writer.drain()