Check if there is a disk failure and if so, handle the error
760621
protected void checkDiskError( ) throws IOException{
    // We disallow concurrent disk checks as it doesn't help
    // but can significantly impact performance and reliability of
    // the system.
    //
    boolean setSuccess = checkingDisk.compareAndSet(false, true);
    if (!setSuccess) {
      LOG.info("checkDiskError is already running.");
      return;
    }

    try {
      // We don't check disks if it's not long since last check.
      //
      long curTime = System.currentTimeMillis();
      if (curTime - timeLastCheckDisk < minDiskCheckIntervalMsec) {
        LOG.info("checkDiskError finished within "
            + minDiskCheckIntervalMsec + " mses. Skip this one.");
        return;
      }
      data.checkDataDir();
      timeLastCheckDisk = System.currentTimeMillis();
    } catch(DiskErrorException de) {
      handleDiskError(de.getMessage());
    } finally {
      checkingDisk.set(false);
    }
  }
35211
def handle_abort(e)
      if log.level == ::Logger::DEBUG
        raise e
      elsif e.class != SystemExit
        @log.error e.message.red
        @log.info 'cleaning up...'

        task_manager.invoke_task_oneshot(:cleanup_local)
      end
      
      Kernel.exit(true)
    end
1337615
function handleError(err) {
  let errMsg = err;

  if (err instanceof Object) {
    errMsg = err.message || err.error || JSON.stringify(err);
  }

  printColumns(chalk.red('Error: ' + errMsg));
  printColumns(
    chalk.white(
      "If you can't settle this, please open an issue at:" + EOL + chalk.cyan(pkg.bugs.url)
    )
  );
  process.exit(1);
}
255688
def task_failure_handler(task_id=None, exception=None,
                         traceback=None, args=None, **kwargs):
    """"""
    # TODO: find a better way to acces workdir/archive/image
    task_report = {'task_id': task_id,
                   'exception': exception,
                   'traceback': traceback,
                   'archive': args[1]['archive_path'],
                   'image': args[1]['image']}
    notifier.send_task_failure_report(task_report)
    workdir = args[1]['workdir']
    remove_file(workdir)
1281109
def handle_error(self, type_, value, tb):
        
        if not issubclass(type_, pywsgi.GreenletExit):
            self.server.loop.handle_error(self.environ, type_, value, tb)
        if self.response_length:
            self.close_connection = True
        else:
            tb_stream = traceback.format_exception(type_, value, tb)
            del tb
            tb_stream.append('\n')
            tb_stream.append(pprint.pformat(self.environ))
            body = ''.join(tb_stream)
            headers = pywsgi._INTERNAL_ERROR_HEADERS[:]
            headers[2] = ('Content-Length', str(len(body)))

            self.start_response(pywsgi._INTERNAL_ERROR_STATUS, headers)
            self.write(body)
351021
def _handle_error(self, data, params):
        """"""
        error = data.get('error', 'API call failed')
        mode = params.get('mode')
        raise SabnzbdApiException(error, mode=mode)
669215
def handle_error(err, halt=True):
        
        print('{}{}{}'.format(c.Style.BRIGHT, c.Fore.RED, err))
        if halt:
            sys.exit(1)
1041323
def error(args):
    
    p = OptionParser(error.__doc__)
    opts, args = p.parse_args(args)

    if len(args) != 2:
        sys.exit(not p.print_help())

    version, backup_folder = args
    mkdir(backup_folder)

    fw = open("errors.log", "w")

    seen = set()
    for g in glob("../5-consensus/*.err"):
        if "partitioned" in g:
            continue

        fp = open(g)
        partID = op.basename(g).rsplit(".err", 1)[0]
        partID = int(partID.split("_")[-1])

        for row in fp:
            if row.startswith(working):
                unitigID = row.split("(")[0].split()[-1]
                continue

            if not failed.upper() in row.upper():
                continue

            uu = (version, partID, unitigID)
            if uu in seen:
                continue
            seen.add(uu)

            print("\t".join(str(x) for x in (partID, unitigID)), file=fw)

            s = [str(x) for x in uu]
            unitigfile = pull(s)
            cmd = "mv {0} {1}".format(unitigfile, backup_folder)
            sh(cmd)

        fp.close()

    logging.debug("A total of {0} unitigs saved to {1}.".\
                 format(len(seen), backup_folder))
938594
def _handle_processing_error(err, errstream, client):
    """"""

    errors = sorted(err.events, key=operator.attrgetter("index"))
    failed = [e.event for e in errors]
    silent = all(isinstance(e.error, OutOfOrderError) for e in errors)
    if errstream:
        _deliver_errored_events(errstream, failed)
        must_raise = False
    else:
        must_raise = True
    for _, event, error, tb in errors:
        if isinstance(error, OutOfOrderError):
            # Not really an error: do not log this to Sentry
            continue
        try:
            raise six.reraise(*tb)
        except Exception as err:
            if client:
                client.captureException()
            msg = "{}{}: {}".format(type(err).__name__,
                    err.args, json.dumps(event, indent=4))
            rlogger.error(msg, exc_info=tb)
            if must_raise:
                raise
1053376
def _check(self):
        """"""
        final = self._md_context.digest()
        exp = self._inf._md_expect
        if exp is None:
            return
        if final is None:
            return
        if self._returncode:
            check_returncode(self, '')
        if self._remain != 0:
            raise BadRarFile("Failed the read enough data")
        if final != exp:
            raise BadRarFile("Corrupt file - CRC check failed: %s - exp=%r got=%r" % (
                self._inf.filename, exp, final))
208148
def handle_error(self, error, download_request):
        
        if hasattr(error, "errno") and error.errno == errno.EACCES:
            self.handle_certificate_problem(str(error))
        else:
            self.handle_general_download_error(str(error), download_request)
438446
def handle_an_error():
    """"""
    import os

    from furious.context import get_current_async

    async = get_current_async()
    async_exception = async.result.payload
    exc_info = async_exception.traceback
    logging.info('async job blew up, exception info: %r', exc_info)

    retries = int(os.environ['HTTP_X_APPENGINE_TASKRETRYCOUNT'])
    if retries < 2:
        raise Exception(async_exception.error)
    else:
        logging.info('Caught too many errors, giving up now.')
171197
def on_IOError(self, e):
        

        sys.stderr.write("Error: %s: \"%s\"\n" % (e.strerror, e.filename))
425515
def handle_error(self, error):
        
        logging.exception("try to sleep if there are repeating errors.")
        error_desc = str(error)
        now = datetime.datetime.now()
        if error_desc not in self.error_time_log:
            self.error_time_log[error_desc] = now
            return

        time_of_last_encounter = self.error_time_log[str(error)]
        time_since_last_encounter = now - time_of_last_encounter
        if time_since_last_encounter.total_seconds() > self.config.get('min_seconds_between_errors'):
            self.error_time_log[error_desc] = now
            return

        if error_desc not in self.error_sleep_log:
            time.sleep(self.config.get('sleep_seconds_on_consecutive_errors'))
            self.error_sleep_log[error_desc] = 1
        else:
            sys.exit()
923560
function onError( error ) {
        logger.error( error.stack || error );
        process.exit( EXIT_FAILURE );
    }
520365
def handle_error(self, failure):
        
        self.logger.error(repr(failure))

        if failure.check(HttpError):
            response = failure.value.response
            self.logger.error(u'HttpError on %s', response.url)
            self.logger.error(u'HttpError Code: %s', response.status)
            if response.status in (401, 403):
                # If the error is from invalid login, tell the user
                self.logger.error(
                    "Credentials failed. Either add/update the current credentials "
                    "or remove them to enable auto auth"
                )
        elif failure.check(DNSLookupError):
            request = failure.request
            self.logger.error(u'DNSLookupError on %s', request.url)
464683
public function checkFatalErrorOnShutDown() {
		$error = error_get_last();
		if($error) {
			ini_set('memory_limit', memory_get_usage(true) + 1000000); // if memory limit exceeded
			$this->callOldHandlers = false;
			$this->handleError($error['type'], $error['message'], $error['file'], $error['line'], null, 1);
		}
	}