Read in the error file from bsub
514125
def fetch_task_failures(self):
        
        error_file = os.path.join(self.tmp_dir, "job.err")
        if os.path.isfile(error_file):
            with open(error_file, "r") as f_err:
                errors = f_err.readlines()
        else:
            errors = ''
        return errors
685085
function MonkeyLearnError(error_code, response, message, fileName, lineNumber) {
  let instance = new Error(message, fileName, lineNumber);
  instance.error_code = error_code;
  instance.response = response;
  Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
  if (Error.captureStackTrace) {
    Error.captureStackTrace(instance, MonkeyLearnError);
  }
  return instance;
}
834108
def rmtree_errorhandler(func, path, exc_info):
    """"""
    # if file type currently read only
    if os.stat(path).st_mode & stat.S_IREAD:
        # convert to read/write
        os.chmod(path, stat.S_IWRITE)
        # use the original function to repeat the operation
        func(path)
        return
    else:
        raise
584372
def get_errors(error_string):
    '''
    

    '''

    lines = error_string.splitlines()
    error_lines = tuple(line for line in lines if line.find('Error') >= 0)
    if len(error_lines) > 0:
        return '\n'.join(error_lines)
    else:
        return error_string.strip()
1268163
def strerror(errno):
    """"""
    from pypy.module._codecs.locale import str_decode_locale_surrogateescape
    return str_decode_locale_surrogateescape(os.strerror(errno))
194859
def load_file(path, encoding, encoding_errors):
    
    abs_path = abspath(path)
    if exists(abs_path):
        return read_unicode(abs_path, encoding, encoding_errors)
    raise IOError('File %s does not exist' % (abs_path))
1275263
function sassError(ctx /*, options*/) {
  if (ctx.line && ctx.message) { // libsass 3.x error object
    return new Error('Line ' + ctx.line + ': ' + ctx.message);
  }
  if (typeof ctx === 'string') { // libsass error string format: path:line: error: message
    var error = _.zipObject(
      [ 'path', 'line', 'level', 'message' ],
      ctx.split(':', 4).map(function (str) { return str.trim(); })
    );
    if (error.line && error.level && error.message) {
      return new Error('Line ' + error.line + ': ' + error.message);
    }
  }

  return new Error(ctx);
}
1102860
function OpenFileCB (err, fd) {
        if (err) {
            response.setHeader('Content-Type','text/html');
            response.writeHead(404, err.toString("utf8"));
            response.write("Hoops:" +  err );
            response.end();
            return;
        }
        fs.fstat(fd, function(err,stats){
            // get file size and allocate buffer to read it
            var buffer = new Buffer (stats.size);
            fs.read (fd, buffer,0,buffer.length,0,ReadFileCB);
        });
    }
450151
def read_file(filename, print_error=True):
    """"""
    try:
        for encoding in ['utf-8', 'latin1']:
            try:
                with io.open(filename, encoding=encoding) as fp:
                    return fp.read()
            except UnicodeDecodeError:
                pass
    except IOError as exception:
        if print_error:
            print(exception, file=sys.stderr)
        return None
628848
def print_error_to_io_stream(err: Exception, io: TextIOBase, print_big_traceback : bool = True):
    
    if print_big_traceback:
        traceback.print_tb(err.__traceback__, file=io, limit=-GLOBAL_CONFIG.multiple_errors_tb_limit)
    else:
        traceback.print_tb(err.__traceback__, file=io, limit=-1)
    io.writelines('  ' + str(err.__class__.__name__) + ' : ' + str(err))
698103
def _error_repr(error):
    """"""
    error_repr = repr(error)
    if len(error_repr) > 200:
        error_repr = hash(type(error))
    return error_repr
146305
def get_error(self):
        """"""
        col_offset = -1
        if self.node is not None:
            try:
                col_offset = self.node.col_offset
            except AttributeError:
                pass
        try:
            exc_name = self.exc.__name__
        except AttributeError:
            exc_name = str(self.exc)
        if exc_name in (None, 'None'):
            exc_name = 'UnknownError'

        out = ["   %s" % self.expr]
        if col_offset > 0:
            out.append("    %s^^^" % ((col_offset)*' '))
        out.append(str(self.msg))
        return (exc_name, '\n'.join(out))
1190971
def read_stdout(self):
        

        output = ""
        if self._stdout_file:
            try:
                with open(self._stdout_file, "rb") as file:
                    output = file.read().decode("utf-8", errors="replace")
            except OSError as e:
                log.warning("Could not read {}: {}".format(self._stdout_file, e))
        return output
438050
function getError(errno, app) {
	let errObj = {
		errno: errno,
		message: errors[errno].replace('$app', app)
	};
	return errObj.message;
}
1037760
def print_errors(filename, errors, output_json=False, compact=False):
    """"""
    if output_json:
        click.echo(errors_to_json(errors))

    else:
        for error in errors:

            (check, message, line, column, start, end,
             extent, severity, replacements) = error

            if compact:
                filename = "-"

            click.echo(
                filename + ":" +
                str(1 + line) + ":" +
                str(1 + column) + ": " +
                check + " " +
                message)
80514
function parse_PtgAttrIfError(blob) {
	var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0;
	blob.l += 2;
	return [bitIf, blob.read_shift(2)];
}
406708
def clean_error(err):
    
    if err:
        decoded = err.decode('utf-8')
        try:
            return decoded.split('\r\n')[-2]
        except Exception:
            return decoded
    return 'There was an error.'