Skip to content

Commit c042ecb

Browse files
committed
Truncate error avoiding CookieOverflowError
The error message can be huge, which can result in a ActionDispatch::Cookies::CookieOverflow. Truncate the flash message and output the whole error to the logs.
1 parent d6620cc commit c042ecb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/active_admin_import/dsl.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def active_admin_import(options = {}, &block)
7676
instance_exec result, options, &DEFAULT_RESULT_PROC
7777
end
7878
rescue ActiveRecord::Import::MissingColumnError, NoMethodError, ActiveRecord::StatementInvalid => e
79-
flash[:error] = I18n.t('active_admin_import.file_error', message: e.message)
79+
Rails.logger.error(I18n.t('active_admin_import.file_error', message: e.message))
80+
flash[:error] = I18n.t('active_admin_import.file_error', message: e.message[0..200])
8081
end
8182
redirect_to options[:back]
8283
end

0 commit comments

Comments
 (0)