Skip to content

Commit 26d7b2a

Browse files
committed
refactor: replace try/catch with runCatching
1 parent c05b471 commit 26d7b2a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

app/src/main/java/to/bitkit/ui/settings/advanced/RgsServerViewModel.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class RgsServerViewModel @Inject constructor(
135135
data
136136
}
137137

138-
return try {
138+
return runCatching {
139139
val uri = URI(normalized)
140140
val hostname = uri.host ?: return false
141141

@@ -145,9 +145,7 @@ class RgsServerViewModel @Inject constructor(
145145

146146
val path = uri.path.orEmpty()
147147
path.isEmpty() || PATH_PATTERN.matches(path)
148-
} catch (_: Throwable) {
149-
false
150-
}
148+
}.getOrDefault(false)
151149
}
152150
}
153151

0 commit comments

Comments
 (0)