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

Method check_known_errors

dialect/providers/modules/lingva.py:124–135  ·  view source on GitHub ↗

Raises a proper Exception if an error is found in the data.

(self, status, data)

Source from the content-addressed store, hash-verified

122 raise UnexpectedError from exc
123
124 def check_known_errors(self, status, data):
125 """Raises a proper Exception if an error is found in the data."""
126 if not data:
127 raise UnexpectedError("Response is empty!")
128
129 if "error" in data:
130 error = data["error"]
131
132 if error == "Invalid target language" or error == "Invalid source language":
133 raise InvalidLangCode(error)
134 else:
135 raise UnexpectedError(error)

Callers

nothing calls this directly

Calls 2

UnexpectedErrorClass · 0.90
InvalidLangCodeClass · 0.90

Tested by

no test coverage detected