From 1e695f7d4c2848885e5eaec1ee2570064a5a0855 Mon Sep 17 00:00:00 2001
From: unknown <ldecicco@usgs.gov>
Date: Tue, 21 Oct 2014 13:47:18 -0500
Subject: [PATCH] Check for url existence in construct function.

---
 R/constructNWISURL.r | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/R/constructNWISURL.r b/R/constructNWISURL.r
index 8e7da895..66756212 100644
--- a/R/constructNWISURL.r
+++ b/R/constructNWISURL.r
@@ -18,6 +18,7 @@
 #' @keywords data import USGS web service
 #' @return url string
 #' @export
+#' @import RCurl
 #' @examples
 #' siteNumber <- '01594440'
 #' startDate <- '1985-01-01'
@@ -181,6 +182,10 @@ constructNWISURL <- function(siteNumber,parameterCd,startDate,endDate,service,st
         }
          
     )
-
-  return(url)
+  if(url.exists(url)){
+    return(url)
+  } else {
+    stop("The following url doesn't seem to exist:\n",url)
+  }
+  
 }
-- 
GitLab