[PR #67] [CLOSED] Raise proper exceptions when converters fail #85

Closed
opened 2026-02-15 23:16:35 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/stoatchat/python-client-sdk/pull/67
Author: @Solarphlare
Created: 8/8/2023
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • c85d7f1 Raise proper exceptions when converters fail

📊 Changes

1 file changed (+8 additions, -0 deletions)

View changed files

📝 revolt/ext/commands/converters.py (+8 -0)

📄 Description

When the converters such as MemberConverter, ChannelConverter and UserConverter are unable to locate their respective item, they raise LookupErrors instead of the errors that are supposed to be raised when they fail—such as ChannelConverterError and MemberConverterError, for example. Since LookupError is raised for all of these converters when they can't find an item, it makes it difficult to distinguish between things like member lookup errors and channel lookup errors in on_command_error().

This PR rectifies the issue by catching any LookupErrors raised by the converters and instead raising the proper errors.

Please make sure to check the following tasks before opening and submitting a PR

  • I understand and have followed the contribution guide
  • I have tested my changes locally and they are working as intended
  • These changes do not have any notable side effects on other Revolt projects

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/stoatchat/python-client-sdk/pull/67 **Author:** [@Solarphlare](https://github.com/Solarphlare) **Created:** 8/8/2023 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`c85d7f1`](https://github.com/stoatchat/python-client-sdk/commit/c85d7f1c7f5c9b3375cc88642fa81443c7be5f61) Raise proper exceptions when converters fail ### 📊 Changes **1 file changed** (+8 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `revolt/ext/commands/converters.py` (+8 -0) </details> ### 📄 Description When the converters such as MemberConverter, ChannelConverter and UserConverter are unable to locate their respective item, they raise LookupErrors instead of the errors that are supposed to be raised when they fail—such as ChannelConverterError and MemberConverterError, for example. Since LookupError is raised for all of these converters when they can't find an item, it makes it difficult to distinguish between things like member lookup errors and channel lookup errors in `on_command_error()`. This PR rectifies the issue by catching any `LookupError`s raised by the converters and instead raising the proper errors. ## Please make sure to check the following tasks before opening and submitting a PR * [x] I understand and have followed the [contribution guide](https://github.com/revoltchat/revolt/discussions/282) * [x] I have tested my changes locally and they are working as intended * [x] These changes do not have any notable side effects on other Revolt projects --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 23:16:35 -05:00
yindo closed this issue 2026-02-15 23:16:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: stoatchat/python-client-sdk#85