Parse the string representation of an exception to a {@link ExceptionInfo} instance.
12514
static ExceptionInfo processStackTrace(StackTrace exception) {
    if (exception == null) {
      return null;
    }
    // Escape any special HTML characters in the exception that would otherwise break the HTML
    // rendering (e.g. the angle brackets around the default toString() for enums).
    String message = StringEscapeUtils.escapeHtml4(exception.toString());

    // Newline characters are usually stripped out by the parsing code in
    // {@link StackTrace#from(String)}, but they can sometimes remain (e.g. when the stack trace
    // is not in an expected format).  This replacement needs to be done after any HTML escaping.
    message = message.replace("\n", "<br/>");

    List<String> lines = exception.getElements()
        .stream()
        .map(element -> "&nbsp;&nbsp;&nbsp;&nbsp;at " + element.toString())
        .collect(toList());
    while (exception.getCause() != null) {
      exception = exception.getCause();
      String causeMessage = StringEscapeUtils.escapeHtml4(exception.toString());
      lines.add("Caused by: " + causeMessage.replace("\n", "<br/>"));
    }
    return new ExceptionInfo(message, lines);
  }
149853
protected Number parseInteger(String string) throws ParseException {
		try {
			return Long.valueOf(string);
		} catch (NumberFormatException e) {
			fail(INTEGER);
			return null;
		}
	}
681696
def from_string(cls, string):
        
        cls.TYPE.setParseAction(cls.make)
        try:
            return cls.TYPE.parseString(string, parseAll=True)[0]
        except ParseException:
            log.error("Failed to parse '{0}'".format(string))
            raise
965417
def __parseForException(self, http_error):
        
        data = http_error.body
        try:
            if isinstance(data, str):
                data = cjson.decode(data)
        except:
            raise http_error

        if isinstance(data, dict) and 'exception' in data:# re-raise with more details
            raise HTTPError(http_error.url, data['exception'], data['message'], http_error.header, http_error.body)

        raise http_error
1274434
public static ContextInfo toContextInfo(final ContextBase context, final ExceptionInfo error) {
    final ContextInfo.Builder builder = ContextInfo.newBuilder()
        .setContextId(context.getId())
        .setEvaluatorId(context.getEvaluatorId())
        .setParentId(context.getParentId().orElse(""))
        .setEvaluatorDescriptorInfo(toEvaluatorDescriptorInfo(
            context.getEvaluatorDescriptor()));
    if (error != null) {
      builder.setException(error);
    }
    return builder.build();
  }
1081433
public static Failure parse(String failure) {
        Failure result = new Failure();
        int dash = failure.indexOf('-');
        int leftBracet = failure.indexOf('(');
        int rightBracet = failure.indexOf(')');
        result.title = failure.substring(0, leftBracet).trim();
        result.code = failure.substring(leftBracet + 1, rightBracet).trim();
        if (dash > 0) {
            result.details = failure.substring(dash + 1).trim();
        }
        return result;
    }
1344736
public final IJSONSerializable<?> fromString(final String string) throws Exception, ValidationException
    {
        final ValidationContext ctx = new ValidationContext();

        ctx.setValidate(true);

        ctx.setStopOnError(true);

        final IJSONSerializable<?> result = fromString(string, ctx);

        if (ctx.getErrorCount() > 0)
        {
            throw new ValidationException(ctx);
        }
        if (null == result)
        {
            throw new Exception("Unknown reason for NULL result in JSONParser");
        }
        return result;
    }
1307194
def parse_error(
        self, exception=ParseError, *args
    ):  # type: (ParseError.__class__, ...) -> ParseError
        
        line, col = self._to_linecol()

        return exception(line, col, *args)
1108906
protected String composeError(Exception error) {
		StringBuilder builder = new StringBuilder();

		while (error != null) {
			if (builder.length() > 0)
				builder.append(" Caused by error: ");

			builder.append(error.getMessage()).append(" StackTrace: ").append(error.getStackTrace());

			try {
				error = error.getClass().newInstance();///// ????
			} catch (InstantiationException | IllegalAccessException e) {
				e.printStackTrace();
			}
		}

		return builder.toString();
	}
430159
private String toStringImpl() throws Exception {

        StringBuffer sb;
        Method[]     methods;
        Method       method;
        int          count;

        sb = new StringBuffer();

        sb.append(super.toString());

        count = getParameterCount();

        if (count == 0) {
            sb.append("[parameterCount=0]");

            return sb.toString();
        }
        methods = getClass().getDeclaredMethods();

        sb.append('[');

        int len = methods.length;

        for (int i = 0; i < count; i++) {
            sb.append('\n');
            sb.append("    parameter_");
            sb.append(i + 1);
            sb.append('=');
            sb.append('[');

            for (int j = 0; j < len; j++) {
                method = methods[j];

                if (!Modifier.isPublic(method.getModifiers())) {
                    continue;
                }

                if (method.getParameterTypes().length != 1) {
                    continue;
                }
                sb.append(method.getName());
                sb.append('=');
                sb.append(method.invoke(this,
                                        new Object[] { new Integer(i + 1) }));

                if (j + 1 < len) {
                    sb.append(',');
                    sb.append(' ');
                }
            }
            sb.append(']');

            if (i + 1 < count) {
                sb.append(',');
                sb.append(' ');
            }
        }
        sb.append('\n');
        sb.append(']');

        return sb.toString();
    }
5034
def exceptionToString(e,silent=False):
    """"""
    exc_type, exc_obj, exc_tb = sys.exc_info()
    s=("\n"+"="*50+"\n")
    s+="EXCEPTION THROWN UNEXPECTEDLY\n"
    s+="  FILE: %s\n"%os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
    s+="  LINE: %s\n"%exc_tb.tb_lineno
    s+="  TYPE: %s\n"%exc_type
    s+='-'*50+'\n'
    s+=traceback.format_exc()
    s=s.strip()+'\n'+"="*50+"\n"
    if not silent:
        print(s)
    return s
1275009
protected String parseDescription(Throwable exception, int status) {
        if (exception instanceof UnprocessableEntityException && StringUtils.isNotBlank(exception.getMessage())) {
            return exception.getMessage();
        }
        return ErrorMessage.parseDescription(status);
    }
1220231
def parse(cls, string):
		'''
			
		'''
		obj, i = cls.match(string, 0)
		if i != len(string):
			raise Exception("Could not parse '" + string + "' beyond index " + str(i))
		return obj
81847
def from_exc_info(cls, exc_info=None,
                      retain_exc_info=True,
                      cause=None, find_cause=True):
        """"""
        if exc_info is None:
            exc_info = sys.exc_info()
            if not any(exc_info):
                raise NoActiveException("No exception currently"
                                        " being handled")
        # This should always be the (type, value, traceback) tuple,
        # either from a prior sys.exc_info() call or from some other
        # creation...
        if len(exc_info) != 3:
            raise ValueError("Provided 'exc_info' must contain three"
                             " elements")
        exc_type, exc_val, exc_tb = exc_info
        try:
            if exc_type is None or exc_val is None:
                raise ValueError("Invalid exception tuple (exception"
                                 " type and exception value must"
                                 " be provided)")
            exc_args = tuple(getattr(exc_val, 'args', []))
            exc_kwargs = dict(getattr(exc_val, 'kwargs', {}))
            exc_type_names = utils.extract_roots(exc_type)
            if not exc_type_names:
                exc_type_name = reflection.get_class_name(
                    exc_val, truncate_builtins=False)
                # This should only be possible if the exception provided
                # was not really an exception...
                raise TypeError("Invalid exception type '%s' (not an"
                                " exception)" % (exc_type_name))
            exception_str = utils.exception_message(exc_val)
            if hasattr(exc_val, '__traceback_str__'):
                traceback_str = exc_val.__traceback_str__
            else:
                if exc_tb is not None:
                    traceback_str = '\n'.join(
                        traceback.format_exception(*exc_info))
                else:
                    traceback_str = ''
            if not retain_exc_info:
                exc_info = None
            if find_cause and cause is None:
                cause = cls._extract_cause(exc_val)
            return cls(exc_info=exc_info, exc_args=exc_args,
                       exc_kwargs=exc_kwargs, exception_str=exception_str,
                       exc_type_names=exc_type_names, cause=cause,
                       traceback_str=traceback_str,
                       generated_on=sys.version_info[0:2])
        finally:
            del exc_type, exc_val, exc_tb
639154
public String parseString(String name) {
        String property = getProperties().getProperty(name);
        if (property == null) {
            throw new NullPointerException();
        }
        return property;
    }
562190
private String readString(InputStream is) throws Exception {
		char delim = (char)read(1)[0];
		StringBuilder sb = new StringBuilder();
		boolean valid = false;
		while(is.available() > 0){
			char c = (char) is.read();
			if(c == delim){
				valid = true;
				break;
			} else if(c == '\\'){
				// read the next character as part of the value
				c = (char) is.read();
				sb.append(c);
			} else{
				sb.append(c);
			}
		}
		if(!valid){
			throw new ParserException("String constant is not quoted with <" + delim + "> : " + sb.toString());
		}
		return "\"" + sb.toString() + "\"";
	}
1305919
public void parse(String string) {
    if (string == null) {
      throw new NullPointerException("string is null");
    }
    int bufferSize = Math.max(MIN_BUFFER_SIZE, Math.min(DEFAULT_BUFFER_SIZE, string.length()));
    try {
      parse(new StringReader(string), bufferSize);
    } catch (IOException exception) {
      // StringReader does not throw IOException
      throw new RuntimeException(exception);
    }
  }