handle errors from neopia, finally!

This commit is contained in:
Emi Matchu 2014-04-04 15:53:53 -05:00
parent d25d2b3398
commit a375707e40
4 changed files with 19 additions and 0 deletions

View file

@ -224,6 +224,18 @@ $(function () {
el.fadeIn('medium');
addDisqusCount();
});
var neopiaError = document.location.search.match(/neopia%5Berror%5D=([^&]+)/);
if (neopiaError !== null) {
var message = decodeURI(neopiaError[1]).replace(/\+/g, ' ');
if (message === "pet not found") {
$('#pet-not-found').show();
} else {
var el = $('#neopia-error');
var text = el.text().replace('%{message}', message);
el.text(text).show();
}
}
});
function addDisqusCount() {

View file

@ -3,6 +3,9 @@
body.outfits-new
+campaign-progress
#pet-not-found, #neopia-error
display: none
#outfit-forms
+clearfix
+module

View file

@ -2,6 +2,9 @@
= campaign_progress
%p#pet-not-found.alert= t 'pets.load.not_found'
%p#neopia-error.alert= t 'pets.load.neopia_error'
#outfit-forms
- localized_cache :action_suffix => 'outfit_forms_intro' do
#pet-preview

View file

@ -801,6 +801,7 @@ en:
pet_download_error:
We couldn't connect to Neopets to look up the pet. Maybe they're down.
Please try again later!
neopia_error: "We couldn't load that pet: \"%{message}\". Try again later?"
users:
index: