Rework classes for better error handling #180

Merged
sirdog3355 merged 1 commit from refactor/itad-classes into dev 2025-12-14 22:44:06 -05:00
sirdog3355 commented 2025-12-14 22:41:26 -05:00 (Migrated from github.com)

While working to address #170 I went ahead and just did an overhaul of the relevant ITAD classes for better error handling and flow overall.

Work done:

  • Added custom API error exception classes
  • Reworked embeds for /game and logging in the cog to include API errors
  • Removed redundant check_connection() method in both ITAD classes which just caused /game to hit the API 2 extra times unnecessarily; new checks built into the API chaining handle this.

Given the fact that ITAD returned status code 403, which typically means unauthorized, when the site was down in it's entirety, it likely means that a 403 return is just how ITAD's API responds when their shit hits the fan.

So, this PR closes #170, insofar as it is impossible to programmatically determine the difference between our API key being rejected and ITAD being down. Though echoing "our API key was rejected" isn't untrue, given if their API is down it technically means it rejects all API keys.

Closes #170

While working to address #170 I went ahead and just did an overhaul of the relevant ITAD classes for better error handling and flow overall. Work done: - Added custom API error exception classes - Reworked embeds for `/game` and logging in the cog to include API errors - Removed redundant `check_connection()` method in both ITAD classes which just caused `/game` to hit the API 2 extra times unnecessarily; new checks built into the API chaining handle this. Given the fact that ITAD returned status code 403, which typically means unauthorized, when the site was down in it's entirety, it likely means that a 403 return is just how ITAD's API responds when their shit hits the fan. So, this PR closes #170, insofar as it is impossible to programmatically determine the difference between our API key being rejected and ITAD being down. Though echoing "our API key was rejected" isn't _untrue_, given if their API is down it technically means it rejects _all_ API keys. Closes #170
Sign in to join this conversation.
No description provided.