Skip to content

Commit

Permalink
api_get fix of http error code handling
Browse files Browse the repository at this point in the history
  • Loading branch information
BERTHET Clement Ext committed Jul 4, 2023
1 parent 4d8e619 commit aa3ee3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ BUGFIXES :

* `setSimulationPathAPI` generate new global parameter `sleep` to add timer to API request
* Correction of `.importOutput()` to use `readAntares()` with `parallel == TRUE` in shiny application
* `setSimulationPathAPI()` delete a redundant API request

DATA :

Expand Down
7 changes: 5 additions & 2 deletions R/API-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ api_get <- function(opts, endpoint, ..., default_endpoint = "v1/studies") {
condition_status_check <- !(!is.na(url_elements[4]) & url_elements[4] %in% c("economy","adequacy") & result$status_code == 404)
if(condition_status_check){
mess_error <- content(result)
mess_error <- paste0("\n[description] : ", mess_error$description,
"\n[IniReaderError]", mess_error$exception)
if(!is.null(names(mess_error)))
mess_error <- paste0("\n[description] : ", mess_error$description,
"\n[IniReaderError] : ", mess_error$exception)
else
mess_error <- NULL
stop_for_status(result, task = mess_error)
}else
warn_for_status(result)
Expand Down

0 comments on commit aa3ee3a

Please sign in to comment.