Skip to content

Commit 1ecc8e7

Browse files
committed
🔊 fix #94 with more comprehensive error message
1 parent fbf92c8 commit 1ecc8e7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sqlite3_to_mysql/transporter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def _translate_type_from_sqlite_to_mysql(self, column_type: str) -> str:
251251
full_column_type: str = column_type.upper()
252252
match: t.Optional[t.Match[str]] = self._valid_column_type(column_type)
253253
if not match:
254-
raise ValueError("Invalid column_type!")
254+
raise ValueError(f'"${column_type}" is not a valid column_type!')
255255

256256
data_type: str = match.group(0).upper()
257257
if data_type in {"TEXT", "CLOB", "STRING"}:

tests/unit/sqlite3_to_mysql_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_translate_type_from_sqlite_to_mysql_invalid_column_type(
3939
with pytest.raises(ValueError) as excinfo:
4040
mocker.patch.object(proc, "_valid_column_type", return_value=False)
4141
proc._translate_type_from_sqlite_to_mysql("text")
42-
assert "Invalid column_type!" in str(excinfo.value)
42+
assert "is not a valid column_type!" in str(excinfo.value)
4343

4444
@pytest.mark.parametrize(
4545
"mysql_integer_type, mysql_string_type, mysql_text_type",

0 commit comments

Comments
 (0)