Skip to content

Commit

Permalink
fix: implement error handling in remoteConfigContent function (#1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangcent authored Mar 30, 2024
1 parent f3f8aa8 commit 6b8b0ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ class RemoteConfigSettingsHelper {
return settingBinder.read().remoteConfig
.parse()
.filter { it.first }
.map { loadConfig(it.second) }
.mapNotNull {
try {
loadConfig(it.second)
} catch (e: Exception) {
logger.error("failed to load config: ${it.second}")
null
}
}
}

fun loadConfig(url: String): ConfigContent {
Expand Down
16 changes: 8 additions & 8 deletions idea-plugin/src/main/resources/.recommend.easy.api.config
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ check_annotated_Validated=```
return
}
```
check_groups=```
check_groups_jakarta=```
for(annMap in annMaps){
def fieldGroups = annMap["groups"] ?: [helper.findClass("jakarta.validation.groups.Default")]
def paramGroups = session.get("json-group") ?: [helper.findClass("jakarta.validation.groups.Default")]
Expand All @@ -245,17 +245,17 @@ check_groups=```
field.required[@jakarta.validation.constraints.NotBlank]=groovy:```
${check_annotated_Validated}
def annMaps = it.annMaps("jakarta.validation.constraints.NotBlank")
${check_groups}
${check_groups_jakarta}
```
field.required[@jakarta.validation.constraints.NotNull]=groovy:```
${check_annotated_Validated}
def annMaps = it.annMaps("jakarta.validation.constraints.NotNull")
${check_groups}
${check_groups_jakarta}
```
field.required[@jakarta.validation.constraints.NotEmpty]=groovy:```
${check_annotated_Validated}
def annMaps = it.annMaps("jakarta.validation.constraints.NotEmpty")
${check_groups}
${check_groups_jakarta}
```


Expand Down Expand Up @@ -291,7 +291,7 @@ check_annotated_Validated=```
return
}
```
check_groups=```
check_groups_javax=```
for(annMap in annMaps){
def fieldGroups = annMap["groups"] ?: [helper.findClass("javax.validation.groups.Default")]
def paramGroups = session.get("json-group") ?: [helper.findClass("javax.validation.groups.Default")]
Expand All @@ -308,17 +308,17 @@ check_groups=```
field.required[@javax.validation.constraints.NotBlank]=groovy:```
${check_annotated_Validated}
def annMaps = it.annMaps("javax.validation.constraints.NotBlank")
${check_groups}
${check_groups_javax}
```
field.required[@javax.validation.constraints.NotNull]=groovy:```
${check_annotated_Validated}
def annMaps = it.annMaps("javax.validation.constraints.NotNull")
${check_groups}
${check_groups_javax}
```
field.required[@javax.validation.constraints.NotEmpty]=groovy:```
${check_annotated_Validated}
def annMaps = it.annMaps("javax.validation.constraints.NotEmpty")
${check_groups}
${check_groups_javax}
```

#[is_file]*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ internal class CachedRequestClassExporterTest : PluginContextLightCodeInsightFix
Mockito.verify(delegateClassExporter, times(1))
.export(any(), any())

TimeUnit.SECONDS.sleep(10)//wait 10s to save cache

boundary.waitComplete(TimeUnit.SECONDS.toMillis(10),false)//wait 10s to save cache
//export again
val requestsAgain = ArrayList<Request>()
classExporter.export(userCtrlPsiClass, requestOnly {
Expand Down

0 comments on commit 6b8b0ae

Please sign in to comment.