Call FormatMessage with a system error number to retrieve
    the descriptive error message.
503987
def format_system_message(errno):
    
    # first some flags used by FormatMessageW
    ALLOCATE_BUFFER = 0x100
    FROM_SYSTEM = 0x1000

    # Let FormatMessageW allocate the buffer (we'll free it below)
    # Also, let it know we want a system error message.
    flags = ALLOCATE_BUFFER | FROM_SYSTEM
    source = None
    message_id = errno
    language_id = 0
    result_buffer = ctypes.wintypes.LPWSTR()
    buffer_size = 0
    arguments = None
    bytes = ctypes.windll.kernel32.FormatMessageW(
        flags,
        source,
        message_id,
        language_id,
        ctypes.byref(result_buffer),
        buffer_size,
        arguments,
    )
    # note the following will cause an infinite loop if GetLastError
    #  repeatedly returns an error that cannot be formatted, although
    #  this should not happen.
    handle_nonzero_success(bytes)
    message = result_buffer.value
    ctypes.windll.kernel32.LocalFree(result_buffer)
    return message
235721
function errMessageFormat (showDiff, pos, title, msg, stack) {
  if (showDiff) {
    return format.red('  ' + pos + ') ' + title + ':\n' + msg) + format.gray('\n' + stack + '\n')
  }
  return format.red('  ' + pos + ') ' + title + ':\n') +
    format.white('     ' + msg) +
    format.white('\n' + stack + '\n')
}
636027
def format_system_message(errno):
    
    # first some flags used by FormatMessageW
    ALLOCATE_BUFFER = 0x100
    ARGUMENT_ARRAY = 0x2000
    FROM_HMODULE = 0x800
    FROM_STRING = 0x400
    FROM_SYSTEM = 0x1000
    IGNORE_INSERTS = 0x200

    # Let FormatMessageW allocate the buffer (we'll free it below)
    # Also, let it know we want a system error message.
    flags = ALLOCATE_BUFFER | FROM_SYSTEM
    source = None
    message_id = errno
    language_id = 0
    result_buffer = ctypes.wintypes.LPWSTR()
    buffer_size = 0
    arguments = None
    format_bytes = ctypes.windll.kernel32.FormatMessageW(
        flags,
        source,
        message_id,
        language_id,
        ctypes.byref(result_buffer),
        buffer_size,
        arguments,
    )
    # note the following will cause an infinite loop if GetLastError
    #  repeatedly returns an error that cannot be formatted, although
    #  this should not happen.
    handle_nonzero_success(format_bytes)
    message = result_buffer.value
    ctypes.windll.kernel32.LocalFree(result_buffer)
    return message
1221993
def _headline(self, error, i: int) -> str:
        
        msgs = Msg()
        # get the error title
        if error.errclass == "fatal":
            msg = msgs.fatal(i)
        elif error.errclass == "warning":
            msg = msgs.warning(i)
        elif error.errclass == "info":
            msg = msgs.info(i)
        elif error.errclass == "debug":
            msg = msgs.debug(i)
        elif error.errclass == "via":
            msg = msgs.via(i)
        else:
            msg = msgs.error(i)
        # function name
        if error.function is not None:
            msg += " from " + colors.bold(error.function)
        if error.caller is not None:
            msg += " called from " + colors.bold(error.caller)
        if error.caller_msg is not None:
            msg += "\n" + error.caller_msg
        if error.function is not None and error.msg is not None:
            msg += ": "
        else:
            msg = msg + " "
        if error.errtype is not None:
            msg += error.errtype + " : "
        if error.msg is not None:
            msg += error.msg
        return msg
1034357
def error(self, text):
		
		self.logger.error("{}{}".format(self.message_prefix, text))
501258
@JsonIgnore
    public String getErrorMessage() {
        return (params.length == 0) ? exceptionCode.getMessageTemplate() :
                String.format(exceptionCode.getMessageTemplate(), params);
    }
822523
def jsonify_error(message_or_exception, status_code=400):
    """"""
    if isinstance(message_or_exception, Exception):
        message = '%s: %s' % (
            message_or_exception.__class__.__name__, message_or_exception)
    else:
        message = message_or_exception

    logging.debug('Returning status=%s, error message: %s',
                  status_code, message)
    response = jsonify(error=message)
    response.status_code = status_code
    return response
122770
def error(self, msg: str) -> None:
        
        # noinspection PyUnresolvedReferences
        s = "{}: {}".format(self.fullname, msg)
        servicemanager.LogErrorMsg(s)
        if self.debugging:
            log.warning(s)
174943
def error_message(e, message=None, cause=None):
    
    if message is None and cause is None:
        return None
    elif message is None:
        return '%s, caused by %r' % (e.__class__, cause)
    elif cause is None:
        return message
    else:
        return '%s, caused by %r' % (message, cause)
37060
def error_msg_callback(self, callback):
        """"""
        if callable(callback):
            self._error_msg_callback = callback
        else:
            self._error_msg_callback = None
955876
def error(self):
        """"""
        try:
            errcode = DeviceErrorCode(self.error_code)
            return "%s (%s): %s" % (errcode.name, errcode.value, self.error_message)
        except:
            return "Error %s: %s" % (self.error_code, self.error_message)
326252
function(msg) {
        var errFunc = function(err) {
            console.log('in getDeviceCalibrationStatus, error', err, msg);
            defered.reject(err);
        };
        return errFunc;
    }
1060528
def wrap_io_os_err(e):
    ''''''
    msg = ''
    if e.strerror:
        msg = e.strerror
    if e.message:
        msg = ' '.join([e.message, msg])
    if e.filename:
        msg = ': '.join([msg, e.filename])
    return msg
1183607
def _get_error_message(self, response):
        """"""

        error_message = 'An error occurred processing your request.'
        try:
            content = response.json()
            # {"errors":[{"code":34,"message":"Sorry,
            # that page does not exist"}]}
            error_message = content['errors'][0]['message']
        except TypeError:
            error_message = content['errors']
        except ValueError:
            # bad json data from Twitter for an error
            pass
        except (KeyError, IndexError):
            # missing data so fallback to default message
            pass

        return error_message
305683
protected String handleError(final String message) {
        notifier().error(formatMessage(message));
        return formatMessage(message);
    }
1261539
def getMessage(self):
        
        msg = str(self.msg)
        if self.args:
            msg = msg % self.args

        if platform.system().lower() == 'windows' or self.levelno < 10:
            return msg
        elif self.levelno >= 50:
            return utils.return_colorized(msg, 'critical')
        elif self.levelno >= 40:
            return utils.return_colorized(msg, 'error')
        elif self.levelno >= 30:
            return utils.return_colorized(msg, 'warn')
        elif self.levelno >= 20:
            return utils.return_colorized(msg, 'info')
        else:
            return utils.return_colorized(msg, 'debug')
768303
@Override public String getMessage() {
    String errnoName = OsConstants.errnoName(errno);
    if (errnoName == null) {
      errnoName = "errno " + errno;
    }
    String description = Libcore.os.strerror(errno);
    return functionName + " failed: " + errnoName + " (" + description + ")";
  }