Sets a unique error code.
        This method returns reference to this exception to implement Builder pattern to chain additional calls.

        :param code: a unique error code

        :return: this exception object
323385
def with_code(self, code):
        
        self.code = code if code != None else 'UNKNOWN'
        self.name = code
        return self
634155
public void setCode(ExprCode code) {
        mCode = code;

        mStartPos = mCode.mStartPos;
        mCurIndex = mStartPos;
    }
707870
def error_codes(self):
        
        request_url = "{}/api/0/error_codes".format(self.instance)
        return_value = self._call_api(request_url)
        return return_value
143246
def set(self, code):
        
        if self.update:
            self.vertices_substitution_dict, self.edges_substitution_dict, self.match_info\
                = self.match.get_variables_substitution_dictionaries(self.g, self.matching_graph)
        try:
            self.matching_graph = self.__apply_code_to_graph(code, self.matching_graph)
        except:
            pass
        try:
            code = self.__substitute_names_in_code(code)
            self.g = self.__apply_code_to_graph(code, self.g)
        except:
            pass
        return True
250144
def factory(codes, base=_Exception):
    

    if not issubclass(base, _Exception):
        raise FactoryException("Invalid class passed as parent: Must be a subclass of an Exception class created with this function",
                               FactoryException.INVALID_EXCEPTION_CLASS, intended_parent=base)

    class Error(base):
        pass

    if isinstance(codes, (list, set, tuple, frozenset)):
        codes = {e: e for e in codes}

    if not isinstance(codes, dict):
        raise FactoryException("Factory codes must be a dict str -> object",
                               FactoryException.INVALID_CODES_LIST, intended_codes=codes)

    for code, value in codes.items():
        try:
            setattr(Error, code, value)
        except TypeError:
            raise FactoryException("Cannot set class attribute: (%r) -> (%r)" % (code, value),
                                   FactoryException.INVALID_CODE_VALUE, attribute=code, value=value)

    return Error
1344889
public void setCode(final String code) {
        if (isAttached()) {
            setCode(getElement(), code);
        } else {
            getElement().setInnerHTML(code);
        }
    }
176038
def abort(code, error=None, message=None):
    
    if error is None:
        flask_abort(code)
    elif isinstance(error, Response):
        error.status_code = code
        flask_abort(code, response=error)
    else:
        body = {
            "status": code,
            "error": error,
            "message": message
        }
        flask_abort(code, response=export(body, code))
1340828
def _init_code(self, code: int) -> None:
        
        if -1 < code < 256:
            self.code = '{:02}'.format(code)
            self.hexval = term2hex(code)
            self.rgb = hex2rgb(self.hexval)
        else:
            raise ValueError(' '.join((
                'Code must be in the range 0-255, inclusive.',
                'Got: {} ({})'
            )).format(code, getattr(code, '__name__', type(code).__name__)))
1005497
def handle_error(self, code, message_values=None, raise_error=True):
        
        try:
            if message_values is None:
                message_values = []
            message = self.error_codes.message(code).format(*message_values)
            self.log.error('Error code: {}, {}'.format(code, message))
        except AttributeError:
            self.log.error('Incorrect error code provided ({}).'.format(code))
            raise RuntimeError(1000, 'Generic Failure, see logs for more details.')
        except IndexError:
            self.log.error(
                'Incorrect message values provided for error code {} ({}).'.format(
                    code, message_values
                )
            )
            raise RuntimeError(1000, 'Generic Failure, see logs for more details.')
        if raise_error:
            raise RuntimeError(code, message)
119225
public void setCodeBuffer(CodeBuffer code) {
        mCodeBuffer = code;
        mOldLineNumberTable = mLineNumberTable;
        mOldLocalVariableTable = mLocalVariableTable;
        mOldStackMapTable = mStackMapTable;
        mAttributes.remove(mLineNumberTable);
        mAttributes.remove(mLocalVariableTable);
        mAttributes.remove(mStackMapTable);
        mLineNumberTable = null;
        mLocalVariableTable = null;
        mStackMapTable = null;
    }
771432
def add_status_code(code):
    

    def class_decorator(cls):
        cls.status_code = code
        _sanic_exceptions[code] = cls
        return cls

    return class_decorator
1269166
protected function error($code, lang_string $message) {
        if (array_key_exists($code, $this->errors)) {
            throw new coding_exception('Error code already defined');
        }
        $this->errors[$code] = $message;
    }
1287985
@com.fasterxml.jackson.annotation.JsonProperty("errorCode")
    public void setInspectorErrorCode(String inspectorErrorCode) {
        this.inspectorErrorCode = inspectorErrorCode;
    }
17692
public static HttpFailure sendErrorResponse(int code, String body) {
    return new HttpFailure(new MockResponse().setResponseCode(code).setBody(body));
  }
254269
def set_exception(self, exception, traceback=None):
        
        if not isinstance(exception, BaseException):
            raise RuntimeError("Exception must be of BaseException type")
        self._exception = exception
        self._traceback = traceback
        self._event.set()
        self._invoke_callbacks()
982477
function createErrorMessage(errorcode) {
	if (errorcode in ERRORS) {
		var args = Array.prototype.slice.call(arguments,1);
		var entry = ERRORS[errorcode];
		if (entry.argcount && entry.argcount!==args.length) {
			// this should only ever get called if we have a bug in this library
			throw new Error("Internal failure. Unexpected usage of internal command. Please report error code: "+errorcode+"(invalid args) to the developer with the following stack trace:"+new Error().stack);
		}
		return new RequestSSLError((args.length ? util.format.apply(util.format,[entry.message].concat(args)) : entry.message), errorcode);
	}
	else {
		// this should only ever get called if we have a bug in this library
		throw new Error("Internal failure. Unexpected usage of internal command. Please report error code: "+errorcode+"(invalid error code) to the developer with the following stack trace:"+new Error().stack);
	}
}
108114
def warn(code, message, **kwargs):
        

        if code in Logger._ignored_codes:
            return

        assert code in Logger._warning_code_to_exception
        exc_type, domain = Logger._warning_code_to_exception[code]

        if domain in Logger._ignored_domains:
            return

        level = WARNING
        if Logger.fatal_warnings:
            level = ERROR

        exc = exc_type(message, **kwargs)

        Logger._log(code, exc.message, level, domain)

        if Logger.fatal_warnings:
            raise exc