Catch errors in keyring read acces
Even if we don't have an API token, we still want to be able to get a
connection - in any case.
Change-Id: I1d76c08be656d476df1a8bf6c97bb94206952012
diff --git a/R/KorAPConnection.R b/R/KorAPConnection.R
index ef20c8d..b152b00 100644
--- a/R/KorAPConnection.R
+++ b/R/KorAPConnection.R
@@ -120,8 +120,8 @@
#' @import keyring
getApiToken <- function(KorAPUrl) {
- if ("keyring" %in% installed.packages()[,1 ]&& has_keyring_support()
- && KorAPUrl %in% key_list(service = apiTokenServiceName))
+ if ("keyring" %in% installed.packages()[,1 ] && has_keyring_support()
+ && tryCatch(KorAPUrl %in% key_list(service = apiTokenServiceName), error = function(e) warning(e), finally = { return(NULL) }))
key_get(apiTokenServiceName, KorAPUrl)
else
NULL