diff --git a/app/errors/user_service_error.rb b/app/errors/user_service_error.rb new file mode 100644 index 0000000..9ef94df --- /dev/null +++ b/app/errors/user_service_error.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +class UserServiceError < StandardError +end diff --git a/app/services/user_service.rb b/app/services/user_service.rb index fcbdf6e..37f181f 100644 --- a/app/services/user_service.rb +++ b/app/services/user_service.rb @@ -14,9 +14,9 @@ class UserService def validate_bet!(match, team) 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 - 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