From 00101559ae3ab1c841c8026366216abde278d07b Mon Sep 17 00:00:00 2001 From: Steffen Neumann Date: Wed, 21 Oct 2020 21:04:46 +0200 Subject: [PATCH] Better error handling in getCtsKey --- DESCRIPTION | 2 +- R/webAccess.R | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 44e6b65..d864b35 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: RMassBank Type: Package Title: Workflow to process tandem MS files and build MassBank records -Version: 2.99.2 +Version: 2.99.3 Authors@R: c( person(given = "RMassBank at Eawag", email = "massbank@eawag.ch", role=c("cre")), diff --git a/R/webAccess.R b/R/webAccess.R index 2f9544b..638b5db 100755 --- a/R/webAccess.R +++ b/R/webAccess.R @@ -270,7 +270,11 @@ getCtsKey <- function(query, from = "Chemical Name", to = "InChIKey") warning("CTS seems to be currently unavailable or incapable of interpreting your request") return(NULL) } - + + if(res$status_code != 200){ + warning(paste("CTS has return code", res$status_code)) + return(NULL) + } r <- fromJSON(data) if(length(r) == 0)