Skip to content

FuncParamType should use ValueError message in self.fail()#3211

Open
StevOti wants to merge 1 commit intopallets:mainfrom
StevOti:funcparamtype-valueerror-message
Open

FuncParamType should use ValueError message in self.fail()#3211
StevOti wants to merge 1 commit intopallets:mainfrom
StevOti:funcparamtype-valueerror-message

Conversation

@StevOti
Copy link

@StevOti StevOti commented Feb 17, 2026

Fixes #3105

When FuncParamType.convert() caught a ValueError, it discarded the exception message and only passed the input value to self.fail(). This meant users lost context about why the conversion failed.

This fix captures and uses the ValueError message, providing better error feedback to users. Falls back to the input value only if the message is empty (backward compatibility).

Includes regression test ensuring the message is surfaced in the BadParameter exception.

When FuncParamType.convert() caught a ValueError, it discarded the
exception message and only passed the input value to self.fail(). This
meant users lost context about why the conversion failed.

This fix captures and uses the ValueError message, providing better error
feedback to users. Falls back to the input value only if the message is
empty (backward compatibility).

Includes regression test ensuring the message is surfaced in the
BadParameter exception.
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.

FuncParamType should use ValueError for self.fail(message)

1 participant

Comments