public static OpenGaussErrorResponsePacket newInstance(final Exception cause) {
        Optional<ServerErrorMessage> serverErrorMessage = findServerErrorMessage(cause);
        return serverErrorMessage.map(OpenGaussErrorResponsePacket::new).orElseGet(() -> createErrorResponsePacket(SQLExceptionTransformEngine.toSQLException(cause, DATABASE_TYPE)));
    }
@Test
    void assertNewInstanceWithUnknownException() {
        Exception cause = new RuntimeException("No reason");
        OpenGaussErrorResponsePacket actual = OpenGaussErrorPacketFactory.newInstance(cause);
        Map<Character, String> actualFields = getFieldsInPacket(actual);
        assertThat(actualFields.size(), is(4));
        assertThat(actualFields.get(OpenGaussErrorResponsePacket.FIELD_TYPE_SEVERITY), is("ERROR"));
        assertThat(actualFields.get(OpenGaussErrorResponsePacket.FIELD_TYPE_CODE), is("58000"));
        assertThat(actualFields.get(OpenGaussErrorResponsePacket.FIELD_TYPE_MESSAGE), is("Unknown exception." + System.lineSeparator() + "More details: java.lang.RuntimeException: No reason"));
        assertThat(actualFields.get(OpenGaussErrorResponsePacket.FIELD_TYPE_ERROR_CODE), is("0"));
    }