User friendly result status

 === Parameters
 reason(Boolean):: Whether to include failure reason information, default to false

 === Return
 (String):: Name of result code
508144
def status(reason = false)
      case @status_code
      when SUCCESS      then 'success'
      when ERROR        then 'error' + (reason ? " (#{truncated_error})" : "")
      when CONTINUE     then 'continue'
      when RETRY        then 'retry' + (reason ? " (#{@content})" : "")
      when NON_DELIVERY then 'non-delivery' + (reason ? " (#{@content})" : "")
      when MULTICAST    then 'multicast'
      when CANCEL       then 'cancel' + (reason ? " (#{@content})" : "")
      end
    end
454518
function ReturnResult(result) {
  if (errors.length) {
    result.errors = errors;
  }
  var state = data.state;
  if (state) {
    var AMS = MathJax.Extension["TeX/AMSmath"];
    var GLYPH = (MathJax.OutputJax.SVG||{}).BBOX.GLYPH;
    state.AMS.startNumber = AMS.startNumber;
    state.AMS.labels = AMS.labels;
    state.AMS.IDs = AMS.IDs;
    state.mmlID = MathJax.ElementJax.mml.SUPER.ID;
    state.glyphs = GLYPH.glyphs;
    state.defs = GLYPH.defs;
    state.n = GLYPH.n;
    state.ID = ID;
  }
  serverState = STATE.READY;
  callback(result, originalData);
  if (serverState === STATE.READY) StartQueue();
}
83304
private boolean isError(Object result) {
		if(result != null){
			if(result instanceof BaseResult){
				BaseResult baseResult = (BaseResult)result;
				return !baseResult.isSuccess();
			}else if(result instanceof MchBase){
				MchBase mchBase = (MchBase)result;
				if("FAIL".equalsIgnoreCase(mchBase.getReturn_code())||
				   "FAIL".equalsIgnoreCase(mchBase.getResult_code())){
					return true;
				}
			}
		}
		return false;
	}
1285718
def get_code(results):
    
    status = EXIT_SUCCESS

    for file_result in results:
        error = any(object_result.errors for object_result in file_result.object_results)

        fatal = file_result.fatal

        if error:
            status |= EXIT_SCHEMA_INVALID
        if fatal:
            status |= EXIT_VALIDATION_ERROR

    return status
507908
def set_result (self, msg, valid=True, overwrite=False):
        
        if self.has_result and not overwrite:
            log.warn(LOG_CHECK,
              "Double result %r (previous %r) for %s", msg, self.result, self)
        else:
            self.has_result = True
        if not isinstance(msg, unicode):
            log.warn(LOG_CHECK, "Non-unicode result for %s: %r", self, msg)
        elif not msg:
            log.warn(LOG_CHECK, "Empty result for %s", self)
        self.result = msg
        self.valid = valid
        # free content data
        self.data = None
748312
def _handleLegacyResult(result):
    
    if not isinstance(result, dict):
        warnings.warn('The Gerrit status callback uses the old way to '
                      'communicate results.  The outcome might be not what is '
                      'expected.')
        message, verified, reviewed = result
        result = makeReviewResult(message,
                                  (GERRIT_LABEL_VERIFIED, verified),
                                  (GERRIT_LABEL_REVIEWED, reviewed))
    return result
494747
function(err, results) {
  if(err) {
    this.success = false;
    this.error = err;
    this.results = null;

    // customize error for error types
    if(util.isError(err)) {
      this.error = {
        message: err.message,
        type: err.type,
        arguments: err.arguments
      };
      if(NODE_ENV === 'development') {
        this.error.stack = err.stack;
      }
    }    

  } else {
    this.success = true;
    this.error = null;      
    this.results = convertToClient(results);    
  }
}
817945
def _handle_api_result(result: Optional[Dict[str, Any]]) -> Any:
    
    if isinstance(result, dict):
        if result.get('status') == 'failed':
            raise ActionFailed(retcode=result.get('retcode'))
        return result.get('data')
34862
def notify_complete(self, result_code, error_info):
        
        if not isinstance(result_code, baseinteger):
            raise TypeError("result_code can only be an instance of type baseinteger")
        if not isinstance(error_info, IVirtualBoxErrorInfo):
            raise TypeError("error_info can only be an instance of type IVirtualBoxErrorInfo")
        self._call("notifyComplete",
                     in_p=[result_code, error_info])
222235
def _onerror(self, result):
        
        self._set_status("FAILED", result)
        logger.error(
            "{}.Failed: {}[{}]: {}".format(
                self.__class__.__name__, self.__class__.path, self.uuid, result
            ),
            extra=dict(
                kmsg=Message(
                    self.uuid, entrypoint=self.__class__.path,
                    params=self.params
                ).dump(),
                kresult=ResultSchema().dump(result) if result else dict()
            )
        )
        return self.onerror(result)
387333
def success(self):
        """"""
        self._check_valid()
        if self._ret_val != 0:
            return False
        return swiglpk.glp_get_status(self._problem._p) == swiglpk.GLP_OPT
786433
def status(self):
        ''''''
        message = self.status_message
        if message is None:
            message = STATUS[self.status_code]
        return '%s %s' % (self.status_code, message)
294810
def result
      if success?
        results = to_hash['results'] || []
        count == 1 ? results.first : results
      else
        Etsy.silent_errors ? [] : validate!
      end
    end
1051256
def raise_error_if_failed!(result)
      return if result.status.statusCode == 0
      error_message = result.status.errorMessage || 'Execution failed!'
      raise RBHive::TCLIConnectionError.new(error_message)
    end
1255484
def _is_error(self):
        '''
        
        '''
        if self.exit_code:
            msg = self.SUCCESS_EXIT_CODES.get(self.exit_code)
            if msg:
                log.info(msg)
            msg = self.WARNING_EXIT_CODES.get(self.exit_code)
            if msg:
                log.warning(msg)

        return self.exit_code not in self.SUCCESS_EXIT_CODES and self.exit_code not in self.WARNING_EXIT_CODES
1122931
def has_result(state, incorrect_msg="Your query did not return a result."):
    

    # first check if there is no error
    has_no_error(state)

    if not state.solution_result:
        raise NameError(
            "You are using has_result() to verify that the student query generated an error, but the solution query did not return a result either!"
        )

    if not state.student_result:
        state.do_test(incorrect_msg)

    return state
162131
public static void verifyScriptExecutionStatus(final Map<String, String> resultMap) {
        if (ZERO_SCRIPT_EXIT_CODE.equals(resultMap.get(SCRIPT_EXIT_CODE))) {
            resultMap.put(RETURN_CODE, RETURN_CODE_SUCCESS);
        } else {
            resultMap.put(RETURN_CODE, RETURN_CODE_FAILURE);
        }
    }