Check to see if there was an error processing an rrdtool command
519082
private void checkErrorStream(Process process) throws Exception {
		// rrdtool should use platform encoding (unless you did something
		// very strange with your installation of rrdtool). So let's be
		// explicit and use the presumed correct encoding to read errors.
		try (
				InputStream is = process.getErrorStream();
				InputStreamReader isr = new InputStreamReader(is, Charset.defaultCharset());
				BufferedReader br = new BufferedReader(isr)
		) {
			StringBuilder sb = new StringBuilder();
			String line;
			while ((line = br.readLine()) != null) {
				sb.append(line);
			}
			if (sb.length() > 0) {
				throw new RuntimeException(sb.toString());
			}
		}
	}
762953
public static function checkErrors()
    {
        if (self::STATUS_SHUTDOWN != self::$_status) {
            $error_msg = 'Worker['. getmypid() .'] process terminated with ';
            $errors    = error_get_last();
            if ($errors && ($errors['type'] === E_ERROR ||
                    $errors['type'] === E_PARSE ||
                    $errors['type'] === E_CORE_ERROR ||
                    $errors['type'] === E_COMPILE_ERROR ||
                    $errors['type'] === E_RECOVERABLE_ERROR)
            ) {
                $error_msg .= self::getErrorType($errors['type']) . " \"{$errors['message']} in {$errors['file']} on line {$errors['line']}\"";
            } else {
                $error_msg .= 'exit()/die(). Please do not call exit()/die() in workerman.';
            }
            self::log($error_msg);
        }
    }
65068
def error(message)
      message = message.red unless message.color?
      puts(stderr, message)
    end
478222
def check(self):
        
        parser = get_parser(self.scheduler_adapter.name, err_file=self.err_file, out_file=self.out_file,
                            run_err_file=self.run_err_file, batch_err_file=self.batch_err_file)
        parser.parse()
        self.errors = parser.errors
        if len(self.errors) == 0:
            return False
        else:
            return True
658844
def check(self):
        

        #for path in self.path.values():
        #    if not os.path.exists(path):
        #        raise RuntimeError("File '{}' is missing".format(path))

        for tool in ('cd-hit', 'prank', 'hmmbuild', 'hmmpress', 'hmmscan', 'phmmer', 'mafft', 'meme'):
            if not self.pathfinder.exists(tool):
                raise RuntimeError("Dependency {} is missing".format(tool))
1021088
def get_error_at(self, cursor):
        """"""
        for error in self._errors:
            if error.includes(self._vim.eval("expand('%:p')"), cursor):
                return error
        return None
694817
def validate(args):
    
    from jcvi.utils.counter import Counter

    p = OptionParser(validate.__doc__)
    opts, args = p.parse_args(args)

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

    outdir, genome = args
    counter = Counter()

    fsnames, suffix = get_fsnames(outdir)
    dsfile = "{0}{1}/{0}.maker.output/{0}_master_datastore_index.log"
    dslogs = [dsfile.format(x, suffix) for x in fsnames]
    all_failed = []
    for f, d in zip(fsnames, dslogs):
        dslog = DatastoreIndexFile(d)
        counter.update(dslog.scaffold_status.values())
        all_failed.extend([(f, x) for x in dslog.failed])

    cmd = 'tail maker.*.out | grep -c "now finished"'
    n = int(popen(cmd).read())
    assert len(fsnames) == n
    print("ALL jobs have been finished", file=sys.stderr)

    nfailed = len(all_failed)
    if nfailed == 0:
        print("ALL scaffolds are completed with no errors", file=sys.stderr)
        return

    print("Scaffold status:", file=sys.stderr)
    print(counter, file=sys.stderr)
    failed = "FAILED"
    fw = open(failed, "w")
    print("\n".join(["\t".join((f, x)) for f, x in all_failed]), file=fw)
    fw.close()

    nlines = sum(1 for x in open("FAILED"))
    assert nlines == nfailed
    print("FAILED !! {0} instances.".format(nfailed), file=sys.stderr)

    # Rebuild the failed batch
    failed_ids = failed + ".ids"
    failed_fasta = failed + ".fasta"
    cmd = "cut -f2 {0}".format(failed)
    sh(cmd, outfile=failed_ids)
    if need_update((genome, failed_ids), failed_fasta):
        cmd = "faSomeRecords {0} {1} {2}".\
                    format(genome, failed_ids, failed_fasta)
        sh(cmd)
1271542
def check(self, radl):
        """"""

        if not radl.get_system_by_name(self.system):
            raise RADLParseException("Invalid system id '%s'" % self.system, line=self.line)
        if not radl.get_configure_by_name(self.configure):
            raise RADLParseException("Invalid configure id '%s'" % self.configure, line=self.line)
96167
private void checkException(DataInputStream inputStream) throws IOException {
        short retCode = inputStream.readShort();
        if(retCode != 0) {
            String error = inputStream.readUTF();
            throw mapper.getError(retCode, error);
        }
    }
599116
private void checkRelaxed(String errorMessage) {
		if (!relaxed) {
			throw new KriptonRuntimeException(errorMessage, true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
		}
		if (error == null) {
			error = "Error: " + errorMessage;
		}
	}
174647
def _check(self, mode=None):
        
        if self.closed:
            raise IOError("%s is closed" % self.__class__.__name__)
        if mode is not None and self.mode not in mode:
            raise IOError("bad operation for mode %r" % self.mode)
782137
def _check_errors(self):
        """"""
        # use this to make sure that sweep, sstart, sstop, and sinterval
        # all have values if one of them has values
        # (P^Q^R^S) OR (-P and -Q and -R and -S)
        # above is the minimal form for this logical statement in DNF
        if not ((self._inn(self.args.sweep) and self._inn(self.args.sstart)
                 and self._inn(self.args.sstop) and self._inn(self.args.sinterval))
                or
                (not self._inn(self.args.sweep) and not self._inn(self.args.sstart) and not
                 self._inn(self.args.sstop) and not self._inn(self.args.sinterval))):
            mutually_inclusive = ["sweep", "sstart", "sstop", "sinterval"]
            print_str = ""
            for each in mutually_inclusive:
                print_str += "    {0}: {1}\n".format(each, getattr(self.args, each))
            raise AssertionError("""You specified one or more of the --sweep,
            --sstart, --stop, or --sinterval arguments but did not specify all of
            them. All of them are required when running the program in sweep mode.
            Do not specify any of these arguments if not running the program in
            sweep mode.\n{0}""".format(print_str))
1035646
def check_notebooks_for_errors(notebooks_directory):
    '''  '''
    print("Checking notebooks in directory {} for errors".format(notebooks_directory))

    failed_notebooks_count = 0
    for file in os.listdir(notebooks_directory):
        if file.endswith(".ipynb"):
            print("Checking notebook " + file)
            full_file_path = os.path.join(notebooks_directory, file)
            output, errors = run_notebook(full_file_path)
            if errors is not None and len(errors) > 0:
                failed_notebooks_count += 1
                print("Errors in notebook " + file)
                print(errors)

    if failed_notebooks_count == 0:
        print("No errors found in notebooks under " + notebooks_directory)
693339
def _errmsg(self, error: "Err", tb: bool=False, i: int=None,
                msgformat: str="terminal") -> str:
        
        if msgformat == "terminal":
            msg = self._headline(error, i)
            if error.ex is not None:
                msg += "\n" + "line " + colors.bold(str(error.line))
                msg += ": " + colors.yellow(error.code)
                msg += "\n" + str(error.file)
                if self.errs_traceback is True or tb is True:
                    if error.tb is not None:
                        msg += "\n" + error.tb
        elif msgformat == "csv":
            sep = ","
            msg = error.msg + sep
            msg += str(error.line) + sep + error.code + sep
            msg += str(error.file)
        elif msgformat == "text":
            sep = ","
            msg = error.msg
            if error.ex is not None:
                msg += sep + str(error.line) + sep + error.code + sep
                msg += str(error.file) + sep         
                if self.errs_traceback is True or tb is True:
                    if error.tb is not None:
                        msg += sep + error.tb
        elif msgformat == "dict":
            msg = {"date": datetime.now()}
            if error.ex is not None:
                msg["msg"] = error.msg
                msg["line"] = error.line
                msg["code"] = error.code
                msg["file"] = error.file         
                if self.errs_traceback is True or tb is True:
                    if error.tb is not None:
                        msg["traceback"] = error.tb
        return msg
1157858
def error(self, cmd, desc=''):
        '''  '''
        return self._label_desc(cmd, desc, self.error_color)
648377
def is_error(self):
        
        qstat = self._grep_qstat('error')
        err = self._grep_status('error')
        if qstat and err:
            return True
        return False
681701
def check_output_error_and_retcode(*popenargs, **kwargs):
    
    if 'stdout' in kwargs:
        raise ValueError('stdout argument not allowed, it will be overridden.')
    process = subprocess.Popen(stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               *popenargs, **kwargs)
    output, error = process.communicate()
    retcode = process.poll()
    return output, error, retcode