diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-03-14 15:42:03 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-03-16 15:35:27 +0300 |
commit | 539bdf73be4a84b1f542801a28f016808d604fe5 (patch) | |
tree | 7c7a06625bdfd49a177709be5db0e155b3ef3ced /app/models/internal_id.rb | |
parent | d9a953c847339c3d906be4540bdc2a3c44f13fca (diff) |
Address review comments.
Diffstat (limited to 'app/models/internal_id.rb')
-rw-r--r-- | app/models/internal_id.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/internal_id.rb b/app/models/internal_id.rb index 6419cdc5b67..f3630ed1ac5 100644 --- a/app/models/internal_id.rb +++ b/app/models/internal_id.rb @@ -67,16 +67,17 @@ class InternalId < ActiveRecord::Base # usage: Symbol to define the usage of the internal id, see InternalId.usages # init: Block that gets called to initialize InternalId record if not present attr_reader :subject, :scope, :init, :scope_attrs, :usage + def initialize(subject, scope, usage, init) @subject = subject @scope = scope @init = init @usage = usage - raise 'scope is not well-defined, need at least one column for scope (given: 0)' if scope.empty? + raise ArgumentError, 'scope is not well-defined, need at least one column for scope (given: 0)' if scope.empty? unless InternalId.usages.keys.include?(usage.to_s) - raise "Usage '#{usage}' is unknown. Supported values are #{InternalId.usages.keys} from InternalId.usages" + raise ArgumentError, "Usage '#{usage}' is unknown. Supported values are #{InternalId.usages.keys} from InternalId.usages" end end |