Detect error from output
176932
def parse_error(lines)
      if lines.size == 1
        case lines.first
          when '# Unknown service' then raise UnknownService
          when '# Bad exit'        then raise BadExit
        end
      end
    end
110284
private double computeOutputError(double output, double[] gradient) {

        double error = 0.0;
        double out = outputLayer.output[0];
        double g = output - out;

        error += (0.5*g * g);


        gradient[0] = g;

        return error;
    }
225088
def check_error_cmd(result):
    
    return (result.value >= ReturnCode.ERRCMD) and (result.value < ReturnCode.WARNING)
831227
def _bad_result(cls, error):
        
        return cls.Result(ok=False, expr='', files={}, stdout='', type='', value=error)
916484
def get_error_message(status_code):
    """"""
    errmsg = ctypes.create_string_buffer(1024)
    nican.ncStatusToString(status_code, len(errmsg), errmsg)
    return errmsg.value.decode("ascii")
892775
def error(msg, log_file=None):
        """"""
        UtilClass.print_msg(msg + os.linesep)
        if log_file is not None:
            UtilClass.writelog(log_file, msg, 'append')
        raise RuntimeError(msg)
133700
def _check_error(response):
        """"""
        if 'error' in response:
            raise InfluxDBError(response['error'])
        elif 'results' in response:
            for statement in response['results']:
                if 'error' in statement:
                    msg = '{d[error]} (statement {d[statement_id]})'
                    raise InfluxDBError(msg.format(d=statement))
329111
def check_output_and_strip(cmd):  # type: (List[Text]) -> Optional[Text]
    
    try:
        result = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
        return result.strip()
    except (OSError, subprocess.CalledProcessError, TypeError, AttributeError):
        # OSError is raised if command doesn't exist
        # CalledProcessError is raised if command returns nonzero
        # AttributeError is raised if result cannot be strip()ped
        return None
648377
def is_error(self):
        
        qstat = self._grep_qstat('error')
        err = self._grep_status('error')
        if qstat and err:
            return True
        return False
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
231152
def error(self, message, print_help=False):
        """"""
        if 'too few arguments' in message.lower():
            target = sys.argv.pop(0)
            sys.argv.insert(
                0, os.path.basename(target) or os.path.relpath(target))
            message = ("%s. Try getting help with `%s --help`"
                       % (message, " ".join(sys.argv)))
        if print_help:
            self.print_help()
        else:
            self.print_usage()
        sys.stderr.write('\nerror: %s\n' % message)
        sys.exit(2)
761100
def check_output_command(file_path, head=None, tail=None):
    ''''''
    if os.path.exists(file_path):
        if sys.platform == 'win32':
            cmds = ['powershell.exe', 'type', file_path]
            if head:
                cmds += ['|', 'select', '-first', str(head)]
            elif tail:
                cmds += ['|', 'select', '-last', str(tail)]
            return check_output(cmds, shell=True).decode('utf-8')
        else:
            cmds = ['cat', file_path]
            if head:
                cmds = ['head', '-' + str(head), file_path]
            elif tail:
                cmds = ['tail', '-' + str(tail), file_path]
            return check_output(cmds, shell=False).decode('utf-8')
    else:
        print_error('{0} does not exist!'.format(file_path))
        exit(1)
921327
def detect_output_type(args):
    """"""
    if not args['single'] and not args['multiple']:
        # Save to multiple files if multiple files/URLs entered
        if len(args['query']) > 1 or len(args['out']) > 1:
            args['multiple'] = True
        else:
            args['single'] = True
989912
def error_handler(f):
    """"""
    @wraps(f)
    def inner(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except NoResultFound:
            abort(404)
        except IntegrityError:
            abort(500)
    return inner
550411
def parse_error(output_dir):
    
    sys.stderr.seek(0)
    std_err = sys.stderr.read().decode('utf-8')
    err_file = os.path.join(output_dir, "eplusout.err")
    if os.path.isfile(err_file):
        with open(err_file, "r") as f:
            ep_err = f.read()
    else:
        ep_err = "<File not found>"
    message = "\r\n{std_err}\r\nContents of EnergyPlus error file at {err_file}\r\n{ep_err}".format(**locals())
    return message
870441
def check_error(result, func, cargs):
    ""
    if result != 0:
        msg = 'Error in "%s": %s' % (func.__name__, get_errors(result) )
        raise RTreeError(msg)
    return
387429
def print_error(msg, color=True):
    
    if color and is_posix():
        safe_print(u"%s[ERRO] %s%s" % (ANSI_ERROR, msg, ANSI_END))
    else:
        safe_print(u"[ERRO] %s" % (msg))