Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Catch exception
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke committed Oct 23, 2021
1 parent cd9701f commit df19013
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/main/kotlin/com/baulsupp/okurl/completion/UrlCompleter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,23 @@ class UrlCompleter(val main: Main) : ArgumentCompleter {
withTimeout(SECONDS.toMillis(2)) {
it.apiCompleter(
"", Main.client, main.credentialsStore, main.completionVariableCache, tokenSet
)
.prefixUrls()
).prefixUrls()
}
}
}

val results = mutableListOf<String>()
for (f in futures) {
try {
results.addAll(
f.await()
.getUrls("")
)
results.addAll(f.await().getUrls("").orEmpty())
} catch (e: ClientException) {
logger.log(Level.WARNING, "http error during url completion", e)
} catch (e: CancellationException) {
logger.log(Level.WARNING, "failure during url completion", e.cause)
} catch (e: ExecutionException) {
logger.log(Level.WARNING, "failure during url completion", e.cause)
} catch (e: Exception) {
logger.log(Level.WARNING, "failure during url completion", e.cause)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"resources": [
{"pattern": "com/baulsupp/.*/.*txt"},
{"pattern": "com/baulsupp/.*json"},
{"pattern": "com/baulsupp/.*/.*json"},
{"pattern": "urls/.*txt"},
{"pattern": "okurl-.*properties"},
{"pattern": "datasettes.txt"}
Expand Down

0 comments on commit df19013

Please sign in to comment.