Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
Package: CyteTypeR
Title: CyteType for R
Version: 0.4.2
Version: 0.4.3
Description: CyteTypeR is the R version of CyteType python package.
Authors@R:
person("Nygen Analytics AB", , ,"contact@nygen.io", role = c("aut", "cre"))
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Depends:
R (>= 4.1.0)
Imports:
askpass,
cli,
crayon,
dplyr,
httpuv,
httr2,
jsonlite,
logger,
Matrix,
methods,
openssl,
purrr,
rhdf5,
Seurat,
Expand All @@ -37,3 +39,4 @@ Remotes:
bioc::rhdf5
Config/testthat/edition: 3
VignetteBuilder: knitr
Config/roxygen2/version: 8.0.0
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ S3method(print,cytetype_api_error)
export(CleanUpArtifacts)
export(CyteTypeR)
export(GetResults)
export(InstallCyteTypeRCli)
export(LoginCyteTypeR)
export(LogoutCyteTypeR)
export(OpenCyteTypeDashboard)
export(PrepareCyteTypeR)
export(SetupCyteTypeR)
export(ViewCyteTypeJob)
export(cytetype_api_error)
importFrom(Matrix,rowSums)
importFrom(Seurat,AddMetaData)
Expand Down
14 changes: 11 additions & 3 deletions R/api.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
req <- req |> req_auth_bearer_token(auth_token)
}

response <- req |> req_perform()
response <- req |>
httr2::req_error(is_error = function(resp) resp_status(resp) == 429L) |>
req_perform()
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
status_code <- resp_status(response)

# Handle specific status codes with switch for clarity
Expand All @@ -49,11 +51,17 @@
},
"401" = {
log_debug("Authentication failed for job {job_id}")
stop("Authentication failed: Invalid or expired auth token")
.stop_authentication(
"Authentication failed: Invalid or expired auth token",
"INVALID_TOKEN"
)
},
"403" = {
log_debug("Authorization failed for job {job_id}")
stop("Authorization failed: Access denied")
.stop_authentication(
"Authorization failed: Access denied",
"ACCESS_DENIED"
)
}
)

Expand Down
Loading
Loading