ropensci / rnoaa

R interface to many NOAA data APIs
https://docs.ropensci.org/rnoaa
Other
330 stars 84 forks source link

Better error handling when dataset ids not found, fields not found, etc. in `erddap_table()` #82

Closed sckott closed 9 years ago

sckott commented 9 years ago

e.g.,

Requesting a field that doesn't exist in a dataset

<r> erddap_table('erdCAMarCatSM', fields = "adf")
 Show Traceback

 Rerun with Debug
 Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
  'file' must be a character string or connection In addition: Warning message:
In check_response_erddap(res) : Error: (500)

A misspelled dataset id

<r> erddap_table('erdCalCOFIfshsi4')
 Show Traceback

 Rerun with Debug
 Error: tt$headers$`content-type` == "application/json;charset=UTF-8" is not TRUE In addition: Warning message:
In erdddap_GET(sprintf(paste0(eurl(), "info/%s/index.json"), datasetid),  :
  client error: (404) Not Found

A longitude val that doesn't make sense

<r> erddap_table('erdCalCOFIfshsiz', fields = c('latitude','longitude','scientific_name'),
+  'latitude>=34.8', 'latitude<=35', 'longitude>=-125', 'longitude<=-adf')
 Show Traceback

 Rerun with Debug
 Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
  'file' must be a character string or connection In addition: Warning message:
In check_response_erddap(res) : Error: (500)