Raise UserServiceError instead of StandardError
This commit is contained in:
parent
a9cee1d651
commit
b9aaccb487
|
|
@ -0,0 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class UserServiceError < StandardError
|
||||||
|
end
|
||||||
|
|
@ -14,9 +14,9 @@ class UserService
|
||||||
|
|
||||||
def validate_bet!(match, team)
|
def validate_bet!(match, team)
|
||||||
if team.nil?
|
if team.nil?
|
||||||
raise 'Betting on no team in a playoff match is not supported' unless match.group_match?
|
raise UserServiceError, 'Betting on no team in a playoff match is not supported' unless match.group_match?
|
||||||
else
|
else
|
||||||
raise 'The given team is not involved in the given match' unless match.teams.include? team
|
raise UserServiceError, 'The given team is not involved in the given match' unless match.teams.include? team
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue