Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 28, 2020. It is now read-only.

Commit 0b708db

Browse files
author
v.promzelev
committed
more verbosity exception
1 parent 829d3c7 commit 0b708db

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

‎lib/activerecord/overflow_signalizer.rb‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@
44
module ActiveRecord
55
class OverflowSignalizer
66
class Overflow < StandardError; end
7-
8-
class UnsupportedType < StandardError
9-
attr_reader :type
10-
11-
def initialize(type = nil)
12-
@type = type
13-
end
14-
end
7+
class UnsupportedType < StandardError; end
158

169
DAY = 24 * 60 * 60
1710
DEFAULT_AVG = 100_000
@@ -33,7 +26,9 @@ def analyse!
3326
model = models.first
3427
next if model.abstract_class? || model.last.nil?
3528
pk = model.columns.select { |c| c.name == model.primary_key }.first
36-
max = MAX_VALUE.fetch(pk.sql_type) { |type| raise UnsupportedType, type }
29+
max = MAX_VALUE.fetch(pk.sql_type) do |type|
30+
raise UnsupportedType, "Model #{model} has primary_key #{model.primary_key} with unsupported type #{type}"
31+
end
3732
if overflow_soon?(max, model)
3833
raise Overflow, overflow_message(table, model.last.public_send(pk.name), max)
3934
end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /