From 6941202d2a587cdefa4b88ebeb0c1ef5f092e570 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 13 Jun 2022 07:01:05 -0300 Subject: [PATCH] Added a list of valid columns when a wrong column is specified - Inspired on rdeterre/kiplot@6a9d8e3 --- kibot/out_bom.py | 3 ++- kibot/out_kibom.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kibot/out_bom.py b/kibot/out_bom.py index b97de596..2fe8ed49 100644 --- a/kibot/out_bom.py +++ b/kibot/out_bom.py @@ -572,7 +572,8 @@ class BoMOptions(BaseOptions): if new_col_l not in valid_columns_l: # The Field_Rename filter can change this situation: # raise KiPlotConfigurationError('Invalid column name `{}`'.format(new_col)) - logger.warning(W_BADFIELD+'Invalid column name `{}`'.format(new_col)) + logger.warning(W_BADFIELD+'Invalid column name `{}`. Valid columns are {}.'. + format(new_col, list(valid_columns_l.values()))) columns.append(new_col) column_levels.append(level) column_comments.append(comment) diff --git a/kibot/out_kibom.py b/kibot/out_kibom.py index bede0b78..65f33f6c 100644 --- a/kibot/out_kibom.py +++ b/kibot/out_kibom.py @@ -267,7 +267,9 @@ class KiBoMConfig(Optionable): self.join.append(col.field+'\t'+col.join) # Check this is a valid column if new_col.lower() not in valid_columns_l: - raise KiPlotConfigurationError('Invalid column name `{}`'.format(new_col)) + # Should we relax it? (as in out_bom) + raise KiPlotConfigurationError('Invalid column name `{}`. Valid columns are {}.'. + format(new_col, list(valid_columns_l.values()))) columns.append(new_col) columns_l[new_col.lower()] = new_col # Create a list of the columns we don't want