Skip to content

Commit

Permalink
Merge pull request #17 from flowr-analysis/16-expose-error-returned-b…
Browse files Browse the repository at this point in the history
…y-flowr

Expose errors instead of returning NULL
  • Loading branch information
EagleoutIce authored Aug 9, 2024
2 parents 45661ff + 9d4ea4c commit f836948
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions R/file_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ request_file_analysis <- function(con,

res <- send_request(con, request)

if (handle_err_result(res)) {
return(NULL)
if (res$type == "error") {
return(list(error = res$reason))
}

return(list(id = id, filetoken = filetoken, res = res))
Expand Down
4 changes: 2 additions & 2 deletions R/slice.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ request_slice <- function(con, filetoken, criteria, id = get_new_id()) {
)
res <- send_request(con, request)

if (handle_err_result(res)) {
return(NULL)
if (res$type == "error") {
return(list(error = res$reason))
}

return(list(id = id, res = res))
Expand Down
7 changes: 0 additions & 7 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
handle_err_result <- function(res) {
if (res$type == "error") {
return(TRUE)
}
return(FALSE)
}

make_id_provider <- function(next_id = 0) {
function() {
next_id <<- next_id + 1
Expand Down

0 comments on commit f836948

Please sign in to comment.