Raise UserServiceError instead of StandardError

This commit is contained in:
Thor77 2019-06-14 14:25:03 +02:00
parent a9cee1d651
commit b9aaccb487
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
2 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1,4 @@
# frozen_string_literal: true
class UserServiceError < StandardError
end

View File

@ -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