Determine how to handle an error and what message to
        display to the user.
        :param exc: Exception
        :param msg: str, the message to display to the user
        :return: None
966048
def handle_error(self, exc, msg):
        
        if self.mode == "api":
            logger.error(msg)
            if self.strict:
                raise exc
        elif self.mode == "cli":
            sys.stderr.write(msg)
            sys.exit(1)
374619
def _handle_run_exception(self, exc):
        
        if len(self._current_tups) == 1:
            tup = self._current_tups[0]
            self.raise_exception(exc, tup)
            if self.auto_fail:
                self.fail(tup)
1005497
def handle_error(self, code, message_values=None, raise_error=True):
        
        try:
            if message_values is None:
                message_values = []
            message = self.error_codes.message(code).format(*message_values)
            self.log.error('Error code: {}, {}'.format(code, message))
        except AttributeError:
            self.log.error('Incorrect error code provided ({}).'.format(code))
            raise RuntimeError(1000, 'Generic Failure, see logs for more details.')
        except IndexError:
            self.log.error(
                'Incorrect message values provided for error code {} ({}).'.format(
                    code, message_values
                )
            )
            raise RuntimeError(1000, 'Generic Failure, see logs for more details.')
        if raise_error:
            raise RuntimeError(code, message)
420664
def error(self, exc):
        
        msg = 'trying to execute a step in the environment: \n' \
              '           - Exception: %s' % exc
        if self.logger is not None:
            self.logger.error(msg)
        self.by_console('      ERROR - %s' % msg)
984619
def error(self, message=None):
        
        if self.__parser__:  # pylint: disable-msg=E1101
            self.__parser__.error(message)  # pylint: disable-msg=E1101
        else:
            self.logger.error(message)
            sys.exit(2)
827928
def raiseError(cls, message):
        
        error_message = "[error] %s" % message
        if cls.__raise_exception__:
            raise Exception(error_message)

        cls.colorprint(error_message, Fore.RED)
        sys.exit(1)
1316824
def exception(  # type: ignore
        self, msg, *args, exc_info=True, **kwargs
    ) -> Task:
        
        return self.error(msg, *args, exc_info=exc_info, **kwargs)
447597
def exception_handler(self, ex):  # pylint: disable=no-self-use
        
        if isinstance(ex, CLIError):
            logger.error(ex)
        else:
            logger.exception(ex)
        return 1
472830
def error (logname, msg, *args, **kwargs):
    
    log = logging.getLogger(logname)
    if log.isEnabledFor(logging.ERROR):
        _log(log.error, msg, args, **kwargs)
284002
def handle_error(self, error: Exception) -> None:
        
        LOGGER.exception("error during pgn parsing")
        self.game.errors.append(error)
330806
def handle_msg(self, c, e):
        
        try:
            self.handler.handle_msg(c, e)
        except Exception as ex:
            backtrace.handle_traceback(ex, c, self.get_target(e), self.config)
806849
def handle_message(self, msg):
        
        if msg.msg_id not in self.msg_types:
            self.report_message_type(msg)
            self.msg_types.add(msg.msg_id)

        self.tc.message('inspection', typeId=msg.msg_id, message=msg.msg,
                        file=os.path.relpath(msg.abspath).replace('\\', '/'),
                        line=str(msg.line),
                        SEVERITY=TC_SEVERITY.get(msg.category))
132560
def display_exc(self):
        """"""
        errmsg = self.get_error()
        if errmsg is not None:
            if self.path is not None:
                errmsg_lines = ["in " + self.path + ":"]
                for line in errmsg.splitlines():
                    if line:
                        line = " " * taberrfmt + line
                    errmsg_lines.append(line)
                errmsg = "\n".join(errmsg_lines)
            printerr(errmsg)
360933
def handle_exception(self, exc):
        
        if isinstance(exc, (exceptions.NotAuthenticated,
                            exceptions.AuthenticationFailed)):
            # WWW-Authenticate header for 401 responses, else coerce to 403
            auth_header = self.get_authenticate_header(self.request)

            if auth_header:
                exc.auth_header = auth_header
            else:
                exc.status_code = status.HTTP_403_FORBIDDEN

        exception_handler = self.settings.EXCEPTION_HANDLER

        context = self.get_exception_handler_context()
        response = exception_handler(exc, context)

        if response is None:
            raise

        response.exception = True
        return response
354295
def err(msg, *args, **kw):
    # type: (str, *Any, **Any) -> None
    
    if len(args) or len(kw):
        msg = msg.format(*args, **kw)

    shell.cprint('-- <31>{}<0>'.format(msg))
689512
def error(message, *args, **kwargs):
    

    print('[!] ' + message.format(*args, **kwargs))
    sys.exit(1)
1200346
def handle_message(self, msg):
        
        if msg.msg_id in self.messagesAllowed:
            super(LimitedReporter, self).handle_message(msg)