diff --git a/app/controllers/pets_controller.rb b/app/controllers/pets_controller.rb index e66a7a91..5b3383fe 100644 --- a/app/controllers/pets_controller.rb +++ b/app/controllers/pets_controller.rb @@ -1,7 +1,8 @@ class PetsController < ApplicationController - rescue_from Pet::PetNotFound, :with => :pet_not_found - rescue_from PetType::DownloadError, SwfAsset::DownloadError, :with => :asset_download_error - rescue_from Pet::DownloadError, :with => :pet_download_error + rescue_from Pet::PetNotFound, with: :pet_not_found + rescue_from PetType::DownloadError, SwfAsset::DownloadError, with: :asset_download_error + rescue_from Pet::DownloadError, with: :pet_download_error + rescue_from Pet::AltStyleNotSupportedYet, with: :alt_style_not_supported_yet def load return modeling_disabled unless user_signed_in? && current_user.admin? @@ -81,4 +82,12 @@ class PetsController < ApplicationController pet_load_error long_message: t('pets.load.modeling_disabled'), status: :forbidden end + + def alt_style_not_supported_yet + pet_load_error( + long_message: "This pet is using the new Alt Styles feature, which " + + "we're still working on. Thank you for trying, we'll be ready soon!!", + status: :bad_request, + ) + end end diff --git a/app/models/pet.rb b/app/models/pet.rb index 4c2208f1..13530018 100644 --- a/app/models/pet.rb +++ b/app/models/pet.rb @@ -33,6 +33,10 @@ class Pet < ApplicationRecord pet_data = viewer_data[:custom_pet] + if pet_data[:alt_style] + raise AltStyleNotSupportedYet + end + self.pet_type = PetType.find_or_initialize_by( species_id: pet_data[:species_id].to_i, color_id: pet_data[:color_id].to_i @@ -117,7 +121,8 @@ class Pet < ApplicationRecord HashWithIndifferentAccess.new(envelope.messages[0].data.body) end - class PetNotFound < Exception;end - class DownloadError < Exception;end + class PetNotFound < RuntimeError;end + class DownloadError < RuntimeError;end + class AltStyleNotSupportedYet < RuntimeError;end end