diff --git a/shard.yml b/shard.yml index 23429b0..732c859 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: hqtrivia -version: 0.2.2 +version: 0.2.3 authors: - Taylor Finnell diff --git a/src/hqtrivia/show_coordinator/hq_coordinator.cr b/src/hqtrivia/show_coordinator/hq_coordinator.cr index 8932b5b..de38aa5 100644 --- a/src/hqtrivia/show_coordinator/hq_coordinator.cr +++ b/src/hqtrivia/show_coordinator/hq_coordinator.cr @@ -3,6 +3,9 @@ module HqTrivia class HttpException < Exception end + class NotAuthenticatedError < Exception + end + def current_show connection_failed = ->(ex : Exception) do HqTrivia.logger.debug("#{self.class.name}: Connection to HQ (#{@country}) server failed...retrying. #{ex}") @@ -13,6 +16,8 @@ module HqTrivia if (200..299).includes?(resp.status_code) Model::Show.from_json(resp.body) + elsif resp.status_code == 401 + raise NotAuthenticatedError.new("Could not authenticate #{@country}, the token is probably expired") else raise HttpException.new("#{resp.body} (#{resp.status_code}) (country: #{@country})") end diff --git a/src/hqtrivia/version.cr b/src/hqtrivia/version.cr index 8ded8b7..59cc297 100644 --- a/src/hqtrivia/version.cr +++ b/src/hqtrivia/version.cr @@ -1,4 +1,4 @@ module HqTrivia # Current HqTrivia version - VERSION = "0.2.2" + VERSION = "0.2.3" end