Skip to content

Commit

Permalink
feat: better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
c1au6i0 committed Sep 27, 2024
1 parent beee1f6 commit befeccf
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: extractus
Title: Extract chemical info from various databases
Version: 0.0.4
Version: 0.0.5
Authors@R:
person(given = "Claudio",
family = "Zanettini",
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(extr_casrn_from_cid)
export(extr_chem_info)
export(extr_comptox)
export(extr_ctd)
Expand Down
4 changes: 2 additions & 2 deletions R/extr_ctd.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extr_ctd <- function(
httr2::req_perform()
},
error = function(e) {
cli::cli_abort("Failed to perform the request: {e$message}")
cli::cli_abort("Failed to perform the request: {conditionMessage(e)}")
}
)

Expand Down Expand Up @@ -207,7 +207,7 @@ extr_tetramer_ <- function(
httr2::req_perform()
},
error = function(e) {
cli::cli_abort("Failed to perform the request: {e$message}")
cli::cli_abort("Failed to perform the request: {conditionMessage(e)}")
}
)

Expand Down
16 changes: 8 additions & 8 deletions R/extr_tox.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extr_iris_ <- function(keyword = NULL,
httr2::req_perform()
},
error = function(e) {
cli::cli_abort("Failed to perform the request: {e$message}")
cli::cli_abort("Failed to perform the request: {conditionMessage(e)}")
}
)

Expand All @@ -54,7 +54,7 @@ extr_iris_ <- function(keyword = NULL,
rvest::html_table()
},
error = function(e) {
cli::cli_abort("Failed to parse the HTML content: {e$message}")
cli::cli_abort("Failed to parse the HTML content: {conditionMessage(e)}")
}
)

Expand Down Expand Up @@ -283,7 +283,7 @@ extr_comptox <- function(ids,
httr2::req_perform()
},
error = function(e) {
cli::cli_abort("Failed to perform the request: {e$message}")
cli::cli_abort("Failed to perform the request: {conditionMessage(e)}")
}
)

Expand All @@ -302,7 +302,7 @@ extr_comptox <- function(ids,
httr2::req_perform()
},
error = function(e) {
cli::cli_abort("Failed to perform the request: {e$message}")
cli::cli_abort("Failed to perform the request: {conditionMessage(e)}")
}
)

Expand Down Expand Up @@ -364,7 +364,7 @@ extr_ice <- function(casrn, assays = NULL, verify_ssl = FALSE, ...) {
httr2::req_perform()
},
error = function(e) {
cli::cli_abort("Failed to perform the request: {e$message}")
cli::cli_abort("Failed to perform the request: {conditionMessage(e)}")
}
)

Expand All @@ -391,10 +391,10 @@ extr_ice <- function(casrn, assays = NULL, verify_ssl = FALSE, ...) {
},
error = function(e) {
if (grepl("Unexpected content type \"text/plain\"", e$message)) {
cli::cli_warn("It seems that the ids were not found in ICE: {e$message}")
cli::cli_warn("It seems that the ids were not found in ICE: {conditionMessage(e)}")
NULL # Or another suitable value
} else {
cli::cli_abort("An unexpected error occurred: {e$message}")
cli::cli_abort("An unexpected error occurred: {conditionMessage(e)}")
}
}
)
Expand All @@ -410,7 +410,7 @@ extr_ice <- function(casrn, assays = NULL, verify_ssl = FALSE, ...) {
as.data.frame()
},
error = function(e) {
cli::cli_abort("Failed to parse the JSON content: {e$message}")
cli::cli_abort("Failed to parse the JSON content: {conditionMessage(e)}")
}
)
}
Expand Down
2 changes: 1 addition & 1 deletion man/extr_pubchem_fema.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/extr_pubchem_ghs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit befeccf

Please sign in to comment.