Skip to content

Commit 41e8e5c

Browse files
committed
Fix to simplify try and catch block.
1 parent bdb7bd7 commit 41e8e5c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/FeatureDevSessionContext.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,12 @@ class FeatureDevSessionContext(val project: Project, val maxProjectSizeBytes: Lo
8484

8585
init {
8686
ignorePatternsWithGitIgnore = try {
87-
(
88-
ignorePatterns + parseGitIgnore().map { pattern ->
89-
try {
90-
Regex(pattern)
91-
} catch (e: Exception) {
92-
null
93-
}
94-
}.filterNotNull()
95-
).toList()
87+
buildList {
88+
addAll(ignorePatterns)
89+
parseGitIgnore().mapNotNull { pattern ->
90+
runCatching { Regex(pattern) }.getOrNull()
91+
}.let { addAll(it) }
92+
}
9693
} catch (e: Exception) {
9794
emptyList()
9895
}

0 commit comments

Comments
 (0)