From ab63017c091f378938dd55eb526534e40b5c4527 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Wed, 20 Mar 2024 13:17:31 +0100 Subject: [PATCH] add more informative error message with bad classif --- R/add_sector_and_borderline.R | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/R/add_sector_and_borderline.R b/R/add_sector_and_borderline.R index bcfc9147..1f6da8a7 100644 --- a/R/add_sector_and_borderline.R +++ b/R/add_sector_and_borderline.R @@ -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:", + "*" = "pacta4banks@rmi.org" + ), + use_cli_format = TRUE ) } 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:", + "*" = "pacta4banks@rmi.org" + ) ) invisible(column)