MCPcopy Create free account
hub / github.com/dialect-app/dialect / check_known_errors

Method check_known_errors

dialect/providers/modules/deepl.py:126–143  ·  view source on GitHub ↗
(self, status, data)

Source from the content-addressed store, hash-verified

124 raise UnexpectedError from exc
125
126 def check_known_errors(self, status, data):
127 message = data.get("message", "") if isinstance(data, dict) else ""
128
129 match status:
130 case 403:
131 if not self.api_key:
132 raise APIKeyRequired(message)
133 raise APIKeyInvalid(message)
134 case 456:
135 raise ServiceLimitReached(message)
136 case 429:
137 raise UnexpectedError("Too many requests!")
138
139 if status != 200:
140 raise UnexpectedError(message)
141
142 if not data:
143 raise UnexpectedError

Callers

nothing calls this directly

Calls 5

APIKeyRequiredClass · 0.90
APIKeyInvalidClass · 0.90
ServiceLimitReachedClass · 0.90
UnexpectedErrorClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected