Skip to content

fix: include offending values in mapping_section assertion error (#1367) - #1416

Open
wangzhengdna-lang wants to merge 1 commit into
pharmaverse:mainfrom
wangzhengdna-lang:1367-fix/mapping-section-error-message
Open

fix: include offending values in mapping_section assertion error (#1367)#1416
wangzhengdna-lang wants to merge 1 commit into
pharmaverse:mainfrom
wangzhengdna-lang:1367-fix/mapping-section-error-message

Conversation

@wangzhengdna-lang

Copy link
Copy Markdown

Issue

Closes #1367

Description

The assertion in .column_mapping_section() (inst/shiny/modules/tab_data/data_mapping.R) threw a generic message when mapping_df contained zero or multiple mapping_section values, giving no clue about the actual content. The error now reports the count and the offending values, e.g.:

mapping_df must contain exactly one unique mapping_section value, but found 2: PK, PD

Definition of Done

  • Error message reports the number and the actual mapping_section values found

How to test

Defensive guard message change — exempt from unit tests per project convention. Verified manually by calling .column_mapping_section() with a two-section data frame, which now produces the message shown above.

Contributor checklist

  • Code passes lintr checks
  • Code passes all unit tests
  • New logic covered by unit tests
  • New logic is documented
  • App or package changes are reflected in NEWS
  • Package version is incremented
  • R script works with the new implementation (if applicable)
  • Settings upload works with the new implementation (if applicable)
  • If any .scss change was done, run data-raw/compile_css.R
  • If a package dependency was added/changed, run data-raw/test_suggests_hidden.R

Notes to reviewer

One-line error message improvement; full test suite 2005 PASS / 0 FAIL locally, spellcheck clean.

…rmaverse#1367)

The assertion in .column_mapping_section() threw a generic message when
mapping_df contained zero or multiple mapping_section values, giving no
clue about the actual content. The error now reports the count and the
offending values, e.g.:

  mapping_df must contain exactly one unique mapping_section value,
  but found 2: PK, PD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error message: include offending values in data_mapping section assertion

1 participant