Skip to content

Commit a5fe20d

Browse files
committed
Fix test fetching columns of not existing table
<ActiveRecord::StatementInvalid> expected but was <ActiveRecord::JDBCError(<java.sql.SQLSyntaxErrorException: Table 'arjdbc_test.animals' doesn't exist>) arjdbc/jdbc/RubyJdbcConnection.java:775:in `execute'
1 parent da7c41f commit a5fe20d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/arjdbc/mysql/adapter.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,15 @@ def jdbc_column_class
235235
::ActiveRecord::ConnectionAdapters::MySQL::Column
236236
end
237237

238+
def translate_exception(exception, message:, sql:, binds:)
239+
case message
240+
when /Table .* doesn't exist/i
241+
StatementInvalid.new(message, sql: sql, binds: binds, connection_pool: @pool)
242+
else
243+
super
244+
end
245+
end
246+
238247
# defined in MySQL::DatabaseStatements which is not included
239248
def default_insert_value(column)
240249
super unless column.auto_increment?

0 commit comments

Comments
 (0)