Skip to content

Commit

Permalink
Merge pull request #239 from rte-antares-rpackage/feature/scenarized_bc
Browse files Browse the repository at this point in the history
api_put() update to return server description + exception message
  • Loading branch information
berthetclement authored Mar 18, 2024
2 parents 7a6dd63 + c148d2a commit 2d0f86c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/API-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ api_put <- function(opts, endpoint, ..., default_endpoint = "v1/studies") {
config,
...
)
stop_for_status(result)
api_content <- content(result)

Check warning on line 135 in R/API-methods.R

View check run for this annotation

Codecov / codecov/patch

R/API-methods.R#L135

Added line #L135 was not covered by tests
if(!is.null(names(api_content)))
api_content <- paste0("\n[Description] : ", api_content$description,

Check warning on line 137 in R/API-methods.R

View check run for this annotation

Codecov / codecov/patch

R/API-methods.R#L137

Added line #L137 was not covered by tests
"\n[Exception] : ", api_content$exception)
else
api_content <- NULL
stop_for_status(result, task = api_content)

Check warning on line 141 in R/API-methods.R

View check run for this annotation

Codecov / codecov/patch

R/API-methods.R#L139-L141

Added lines #L139 - L141 were not covered by tests
content(result)
}

Expand Down

0 comments on commit 2d0f86c

Please sign in to comment.