From b9aaccb4870be712b9cfa39773fdbdc5b717bbfa Mon Sep 17 00:00:00 2001 From: Thor77 Date: Fri, 14 Jun 2019 14:25:03 +0200 Subject: [PATCH] Raise UserServiceError instead of StandardError --- app/errors/user_service_error.rb | 4 ++++ app/services/user_service.rb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 app/errors/user_service_error.rb 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