Skip to content

Commit

Permalink
minor changes in the error catching code
Browse files Browse the repository at this point in the history
  • Loading branch information
sameerpadhye committed Oct 1, 2024
1 parent eef55c6 commit 0d2077c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/helper.POSTapi_download_w_json2df.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ post.api.res.fetch<-function (base.url,
)
)

if (httr::status_code(result) != 200)
if (httr::status_code(result) < 200 || httr::status_code(result)>=300)
{
stop(paste("Data could not be retrieved. Please check the get_by & identifiers. Please also re-confirm whether the API key has the necessary permissions to obtain the requested data."))
}
Expand Down
2 changes: 1 addition & 1 deletion R/helper.get.bin.project.dataset.pids.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bin.dataset.project.pids<-function (get.data.input,
add_headers('accept' = 'application/json',
'api-key' = apikey))

if (httr::status_code(get.data) != 200)
if (httr::status_code(get.data) < 200 || httr::status_code(get.data)>=300)
{
stop(paste("Data could not be retrieved. Please check the get_by & identifiers. Please also re-confirm whether the API key has the necessary permissions to obtain the requested data."))
}
Expand Down

0 comments on commit 0d2077c

Please sign in to comment.