public ConfigOperateResult insertOrUpdate(String srcIp, String srcUser, ConfigInfo configInfo,
            Map<String, Object> configAdvanceInfo) {
        try {
            ConfigInfoStateWrapper configInfoState = findConfigInfoState(configInfo.getDataId(), configInfo.getGroup(),
                    configInfo.getTenant());
            if (configInfoState == null) {
                return addConfigInfo(srcIp, srcUser, configInfo, configAdvanceInfo);
            } else {
                return updateConfigInfo(configInfo, srcIp, srcUser, configAdvanceInfo);
            }
            
        } catch (Exception exception) {
            LogUtil.FATAL_LOG.error("[db-error] try to update or add config failed, {}", exception.getMessage(),
                    exception);
            throw exception;
        }
    }
@Test
    void testInsertOrUpdateOfException() {
        String dataId = "dataId";
        String group = "group";
        String tenant = "tenant";
        //mock get config state
        Mockito.when(jdbcTemplate.queryForObject(anyString(), eq(new Object[] {dataId, group, tenant}),
                eq(CONFIG_INFO_STATE_WRAPPER_ROW_MAPPER))).thenReturn(null);
        //mock insert config throw exception
        long insertConfigIndoId = 12345678765L;
        GeneratedKeyHolder generatedKeyHolder = TestCaseUtils.createGeneratedKeyHolder(insertConfigIndoId);
        externalStorageUtilsMockedStatic.when(ExternalStorageUtils::createKeyHolder).thenReturn(generatedKeyHolder);
        Mockito.when(jdbcTemplate.update(any(PreparedStatementCreator.class), any(KeyHolder.class)))
                .thenThrow(new CannotGetJdbcConnectionException("mock fail"));
        Map<String, Object> configAdvanceInfo = new HashMap<>();
        configAdvanceInfo.put("config_tags", "tag1,tag2");
        ConfigInfo configInfo = new ConfigInfo(dataId, group, tenant, null, "content");
        try {
            externalConfigInfoPersistService.insertOrUpdate("srcIp", "srcUser", configInfo, configAdvanceInfo);
            assertTrue(false);
        } catch (Exception e) {
            assertEquals("mock fail", e.getMessage());
        }
        
    }