commit | 59e449b05f77f0433a26780dd6cd1554603961a7 | [log] [tgz] |
---|---|---|
author | Marc Kupietz <kupietz@ids-mannheim.de> | Thu Dec 12 12:53:54 2019 +0100 |
committer | Marc Kupietz <kupietz@ids-mannheim.de> | Thu Dec 12 12:55:10 2019 +0100 |
tree | 96a5894579154f5c2b3eec46cde689b9d95f6ac8 | |
parent | 23daf5b6fc4ed2699940dbb33533f7910347146d [diff] |
Combine withCallingHandlers with tryCatch to catch keyring errors see: https://cran.r-project.org/web/packages/tryCatchLog/vignettes/tryCatchLog-intro.html#workaround-2-withcallinghandlers-trycatch Change-Id: I845dd8a0b9acf4d78340e563b2bbbbabd10b0d59
diff --git a/R/KorAPConnection.R b/R/KorAPConnection.R index 69eecf7..3720c24 100644 --- a/R/KorAPConnection.R +++ b/R/KorAPConnection.R
@@ -120,9 +120,10 @@ #' @import keyring getAccessToken <- function(KorAPUrl) { - keyList <- withCallingHandlers(key_list(service = accessTokenServiceName), + keyList <- tryCatch(withCallingHandlers(key_list(service = accessTokenServiceName), warning = function(w) invokeRestart("muffleWarning"), - error = function(e) return(NULL)) + error = function(e) return(NULL)), + error = function(e) { }) if (KorAPUrl %in% keyList) key_get(accessTokenServiceName, KorAPUrl) else