refactor(exceptions): MinimaxRequestError is a subclass of MinimaxAPIError, conflating two error categories
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
Direzione di ricerca
Inizia da minimax_mcp/exceptions.py per esaminare l’attuale gerarchia delle eccezioni, quindi rivedi gli handler di MinimaxAPIError in minimax_mcp/server.py. Scegli l’approccio con base neutra descritto nell’issue, preserva le categorie distinte API e request e verifica che i test esistenti di PR #87 continuino a passare con il comportamento delle eccezioni previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
In minimax_mcp/exceptions.py:
class MinimaxAPIError(Exception):
"""Base exception for Minimax API errors."""
pass
class MinimaxRequestError(MinimaxAPIError):
"""Request related errors."""
pass
MinimaxRequestError is a subclass of MinimaxAPIError, but the two represent different error categories:
MinimaxAPIError— problems talking to the remote API (auth, network, 5xx, etc.). Worth retrying.MinimaxRequestError— client-side problems (missing required field, bad combination, etc.). Never worth retrying.
Because of the inheritance, every except MinimaxAPIError block in minimax_mcp/server.py also catches MinimaxRequestError. This makes it impossible for callers to handle "transient" vs "permanent" failures differently — and it complicates retry logic, metrics, and error budgets.
Impact
- All tool functions return the same generic error message format for both transient and permanent failures, even though clients might want to retry one and not the other.
- The PR #87 test suite had to be written around the inheritance — e.g.
with pytest.raises(MinimaxRequestError)works, but a hypotheticaltry/except MinimaxAPIError: retry()would also catchMinimaxRequestError, which is the wrong behavior.
Suggested fix
Two options, in order of preference:
- Make them siblings under
MinimaxError(rename the current base toMinimaxErroror add a new neutral base). BothMinimaxAPIErrorandMinimaxRequestErrorshould be siblings, not parent/child. - At minimum, update existing
except MinimaxAPIError as e:blocks toexcept (MinimaxAPIError, MinimaxRequestError) as e:(orexcept MinimaxError as e:after the refactor) and document the categories in each tool's docstring.
Option 1 is cleaner and a one-file change.
Discovered via
Issue filed as a follow-up to PR #87 (test coverage). Tests pass either way, but the inheritance makes the error-handling story confusing for new contributors.
🤖 Generated with Claude Code
- Lingua principale
- Python
- Stelle
- 1.6k
- Fork
- 284
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MiniMax-AI/MiniMax-MCP
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
MiniMax-AI/MiniMax-MCP#88 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
MiniMax-AI/MiniMax-MCP#78 ·
-
fix(server): music_generation has inconsistent indentation — try block indented inside function body Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
MiniMax-AI/MiniMax-MCP#69 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
MiniMax-AI/MiniMax-MCP#105 · 1 commento ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
MiniMax-AI/MiniMax-MCP#103 ·
Tutte le issue di MiniMax-AI/MiniMax-MCP
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100