ResponseProcessor<String> () { return new ResponseProcessor<>() { @Override protected String parseResponse(ProtocolFrame response) throws PyDebuggerException { final PyDebugValue value = ProtocolParser.parseValue(response.getPayload(), getDebugger().getDebugProcess()); return value.getValue(); } @Override protected String parseException(ProtocolFrame response) throws PyDebuggerException { Optional<PyDebugValue> optional = ProtocolParser.parseValues(response.getPayload(), getDebugger().getDebugProcess()) .stream() .filter(elem -> elem.getName().equals("exception_occurred")) .findFirst(); return optional.map(PyDebugValue::getValue).orElse(null); } }; }