From f95382a3c1e1e3cc77ef67d98fea2e923af187f2 Mon Sep 17 00:00:00 2001 From: Vladislav Syabruk Date: Thu, 8 Aug 2024 17:23:25 +0300 Subject: [PATCH] Handle Net errors --- .../connection_adapters/clickhouse/schema_statements.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/active_record/connection_adapters/clickhouse/schema_statements.rb b/lib/active_record/connection_adapters/clickhouse/schema_statements.rb index 8c685c7e..d6dd0210 100644 --- a/lib/active_record/connection_adapters/clickhouse/schema_statements.rb +++ b/lib/active_record/connection_adapters/clickhouse/schema_statements.rb @@ -45,6 +45,8 @@ def internal_exec_query(sql, name = nil, binds = [], prepare: false, async: fals ActiveRecord::Result.new(result['meta'].map { |m| m['name'] }, result['data'], result['meta'].map { |m| [m['name'], type_map.lookup(m['type'])] }.to_h) rescue ActiveRecord::ActiveRecordError => e raise e + rescue Net::ReadTimeout, Net::WriteTimeout, Net::OpenTimeout => e + raise ActiveRecord::ConnectionFailed, "Response: #{e.message}" rescue StandardError => e raise ActiveRecord::ActiveRecordError, "Response: #{e.message}" end