Skip to content

Commit

Permalink
Don't override the set ConverterFailure text
Browse files Browse the repository at this point in the history
  • Loading branch information
norinorin authored and tandemdude committed May 31, 2021
1 parent 0b2a3e6 commit 85c17d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lightbulb/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,15 @@ async def _convert_args(
try:
new_arg = await self.handle_types(arg, details.annotation)
new_args.append(new_arg)
except (errors.ConverterFailure, ValueError):
except (errors.ConverterFailure, ValueError) as exc:
_LOGGER.error(
"Failed converting %s with converter: %s",
arg,
getattr(details.annotation, "__name__", repr(details.annotation)),
)
if isinstance(exc, errors.ConverterFailure) and exc.text:
raise # don't override the preset text

raise errors.ConverterFailure(
text=f"Failed converting {arg} with converter: {getattr(details.annotation, '__name__', repr(details.annotation))}"
)
Expand Down

0 comments on commit 85c17d9

Please sign in to comment.