Extract the error code and error description from an error returned by the device.
964978
def _extract_upnperror(self, err_xml):
        
        nsmap = {'s': list(err_xml.nsmap.values())[0]}
        fault_str = err_xml.findtext(
            's:Body/s:Fault/faultstring', namespaces=nsmap)
        try:
            err = err_xml.xpath(
                's:Body/s:Fault/detail/*[name()="%s"]' % fault_str, namespaces=nsmap)[0]
        except IndexError:
            msg = 'Tag with name of %r was not found in the error response.' % fault_str
            self._log.debug(
                msg + '\n' + etree.tostring(err_xml, pretty_print=True).decode('utf8'))
            raise SOAPProtocolError(msg)

        err_code = err.findtext('errorCode', namespaces=err.nsmap)
        err_desc = err.findtext('errorDescription', namespaces=err.nsmap)

        if err_code is None or err_desc is None:
            msg = 'Tags errorCode or errorDescription were not found in the error response.'
            self._log.debug(
                msg + '\n' + etree.tostring(err_xml, pretty_print=True).decode('utf8'))
            raise SOAPProtocolError(msg)
        return int(err_code), err_desc
107379
function extractMessage(error) {
	var {message} = error
	if (error.plugin === 'babel') {
		// Hey Babel, you're not helping!
		var filepath = error.id
		var message = error.message
		function stripFilePath() {
			var index = message.indexOf(filepath)
			console.log(index, filepath.length)
			message = message.slice(0, index) + message.slice(filepath.length + 1)
			message = message.trim()
		}
		if (message.includes(filepath)) {
			stripFilePath()
		} else {
			filepath = filepath.replace(/\\/g, '/')
			if (message.includes(filepath))
				stripFilePath()
		}
	}
	return message
}
1013058
def _parse_ftp_error(error):
    # type: (ftplib.Error) -> Tuple[Text, Text]
    """"""
    code, _, message = text_type(error).partition(" ")
    return code, message
540217
def decodeRPCErrorMsg(e):
    
    found = re.search(
        (
            "(10 assert_exception: Assert Exception\n|"
            "3030000 tx_missing_posting_auth)"
            ".*: (.*)\n"
        ),
        str(e),
        flags=re.M,
    )
    if found:
        return found.group(2).strip()
    else:
        return str(e)
438050
function getError(errno, app) {
	let errObj = {
		errno: errno,
		message: errors[errno].replace('$app', app)
	};
	return errObj.message;
}
196235
def _extract_msg_from_last_exception():
    '''  '''
    last_exc_type, last_error, last_traceback = sys.exc_info()
    if isinstance(last_error, exceptions.DXAPIError):
        # Using the same code path as below would not
        # produce a useful message when the error contains a
        # 'details' hash (which would have a last line of
        # '}')
        return last_error.error_message()
    else:
        return traceback.format_exc().splitlines()[-1].strip()
35198
def get_error(self):
        """"""
        exc_info = sys.exc_info()
        if exc_info[0] is None:
            return None
        else:
            err_type, err_value, err_trace = exc_info[0], exc_info[1], None
            if self.verbose and len(exc_info) > 2:
                err_trace = exc_info[2]
            return format_error(err_type, err_value, err_trace)
212095
def from_errno(cls, errno):
        """"""
        message = '{}: {}'.format(pyuv.errno.errorcode.get(errno, errno),
                                    pyuv.errno.strerror(errno))
        return cls(message, errno)
440603
function extractError(response, request) {

	var result,
	    entry,
	    req,
	    i;

	response = Blast.Bound.Array.cast(response);
	request = Blast.Bound.Array.cast(request);

	for (i = 0; i < response.length; i++) {
		entry = response[i];

		if (entry.error) {
			req = request[i] || {};
			result = new Error('Error in "' + req.type + '" command: ' + entry.error);
			result.type = req.type;
			result.vbmsg = entry.error;
			result.req = req;
			break;
		}
	}

	if (result) {
		result.original_response = response;
	}

	return result;
}
892422
def _get_error_reason(response):
        
        try:
            body = response.json()
            if body and 'reason' in body:
                return body['reason']
        except ValueError:
            pass
        return response.content
690158
def error_message(self):
        ""
        output = self.msg + ", code " + str(self.code)
        output += ". Request Time={}, Request ID={}".format(self.timestamp, self.req_id)
        if self.name != self.__class__.__name__:
            output = self.name + ": " + output
        return output
707870
def error_codes(self):
        
        request_url = "{}/api/0/error_codes".format(self.instance)
        return_value = self._call_api(request_url)
        return return_value
113165
def error(wi_or_fei)

      fei = Ruote.extract_fei(wi_or_fei)
      err = @context.storage.get('errors', "err_#{fei.sid}")

      err ? ProcessError.new(err) : nil
    end
897693
public String getDescription() {
        if (description != null) {
            return description;
        }
        if (UNKNOWN_ERROR.equals(getCode())) {
            return String.format("Received error with code %s", getCode());
        }
        return "Failed with unknown error";
    }
670319
def error(errors):
    """"""
    e_tree, e_oaipmh = envelope()
    for code, message in errors:
        e_error = SubElement(e_oaipmh, etree.QName(NS_OAIPMH, 'error'))
        e_error.set('code', code)
        e_error.text = message
    return e_tree
806878
def parse_device_information(
        device_info_string: str) -> Mapping[str, str]:
    '''
        
    '''
    error_msg = 'Unexpected argument to parse_device_information: {}'.format(
        device_info_string)
    if not device_info_string or \
            not isinstance(device_info_string, str):
        raise ParseError(error_msg)
    parsed_values = device_info_string.strip().split(' ')
    if len(parsed_values) < 3:
        log.error(error_msg)
        raise ParseError(error_msg)
    res = {
        parse_key_from_substring(s): parse_string_value_from_substring(s)
        for s in parsed_values[:3]
    }
    for key in ['model', 'version', 'serial']:
        if key not in res:
            raise ParseError(error_msg)
    return res
436016
private void extractErrors(JsonObject object) {
        JsonObject response;
        try {
            response = object.getAsJsonObject("response");
        } catch (ClassCastException ex) {
            return; // response is non-object
        }
        if (response == null) { return; }

        JsonArray e = response.getAsJsonArray("errors");
        if (e == null) { return; }

        // Set the errors
        errors = new ArrayList<String>(e.size());
        for (int i = 0; i < e.size(); i++) {
            errors.add(e.get(i).getAsString());
        }
    }