Skip to content

Commit

Permalink
add more informative error message with bad classif
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhoffa committed Mar 20, 2024
1 parent 434d74e commit ab63017
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions R/add_sector_and_borderline.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,27 @@ check_classification <- function(data,
abort_all_sec_classif_unknown <- function(column, known) {
abort(
class = "all_sec_classif_unknown",
message = glue(
"Some `{column}` must be known, i.e. one of:
{collapse2(known)}"
)
message = c(
glue("Some `{column}` must be known, i.e. one of: {collapse2(known)}"),
"i" = "If you wish to request a new sector classification system, please create an issue here:",
"*" = "https://github.com/RMI-PACTA/r2dii.data/issues",
"i" = "Or contact the PACTA team here:",
"*" = "[email protected]"

Check warning on line 98 in R/add_sector_and_borderline.R

View check run for this annotation

Codecov / codecov/patch

R/add_sector_and_borderline.R#L93-L98

Added lines #L93 - L98 were not covered by tests
),
use_cli_format = TRUE

Check warning on line 100 in R/add_sector_and_borderline.R

View check run for this annotation

Codecov / codecov/patch

R/add_sector_and_borderline.R#L100

Added line #L100 was not covered by tests
)
}

warn_some_sec_classif_unknown <- function(column, unknown) {
warn(
class = "some_sec_classif_unknown",
message = glue(
"Some `{column}` are unknown:
{collapse2(unknown)}"
)
message = c(
glue("Some `{column}` are unknown:{collapse2(unknown)}"),
"i" = "If you wish to request a new sector classification system, please create an issue here:",
"*" = "https://github.com/RMI-PACTA/r2dii.data/issues",
"i" = "Or contact the PACTA team here:",
"*" = "[email protected]"

Check warning on line 112 in R/add_sector_and_borderline.R

View check run for this annotation

Codecov / codecov/patch

R/add_sector_and_borderline.R#L107-L112

Added lines #L107 - L112 were not covered by tests
)
)

invisible(column)
Expand Down

0 comments on commit ab63017

Please sign in to comment.