Fixed some promises not handling errors
This commit is contained in:
parent
e57de564d9
commit
752af358df
4 changed files with 25 additions and 13 deletions
|
@ -296,6 +296,7 @@ App.Controls.TagInput = function($underlyingInput) {
|
||||||
attachTagsToSuggestionList($siblings.find('ul'), suggestions);
|
attachTagsToSuggestionList($siblings.find('ul'), suggestions);
|
||||||
$siblings.slideDown('fast');
|
$siblings.slideDown('fast');
|
||||||
}
|
}
|
||||||
|
}).fail(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,9 @@ App.Presenters.PostListPresenter = function(
|
||||||
function() {
|
function() {
|
||||||
reinit(params, function() {});
|
reinit(params, function() {});
|
||||||
});
|
});
|
||||||
|
}).fail(function() {
|
||||||
|
console.log(arguments);
|
||||||
|
loaded();
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery(window).on('resize', windowResized);
|
jQuery(window).on('resize', windowResized);
|
||||||
|
|
|
@ -109,6 +109,7 @@ App.Presenters.PostPresenter = function(
|
||||||
$prevPost.removeAttr('href');
|
$prevPost.removeAttr('href');
|
||||||
keyboard.unbind('d');
|
keyboard.unbind('d');
|
||||||
}
|
}
|
||||||
|
}).fail(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,11 @@ App.Services.PostsAroundCalculator = function(_, promise, util, pager) {
|
||||||
getLinkToPostAround(postIds, position, query.page, 1))
|
getLinkToPostAround(postIds, position, query.page, 1))
|
||||||
.then(function(nextPostUrl, prevPostUrl) {
|
.then(function(nextPostUrl, prevPostUrl) {
|
||||||
resolve(nextPostUrl, prevPostUrl);
|
resolve(nextPostUrl, prevPostUrl);
|
||||||
|
}).fail(function() {
|
||||||
|
reject();
|
||||||
});
|
});
|
||||||
|
}).fail(function() {
|
||||||
|
reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -41,20 +45,23 @@ App.Services.PostsAroundCalculator = function(_, promise, util, pager) {
|
||||||
resolve(url);
|
resolve(url);
|
||||||
} else if (page + direction >= 1) {
|
} else if (page + direction >= 1) {
|
||||||
pager.setPage(page + direction);
|
pager.setPage(page + direction);
|
||||||
promise.wait(pager.retrieveCached()).then(function(response) {
|
promise.wait(pager.retrieveCached())
|
||||||
if (response.entities.length) {
|
.then(function(response) {
|
||||||
var post = direction === - 1 ?
|
if (response.entities.length) {
|
||||||
_.last(response.entities) :
|
var post = direction === - 1 ?
|
||||||
_.first(response.entities);
|
_.last(response.entities) :
|
||||||
|
_.first(response.entities);
|
||||||
|
|
||||||
var url = util.appendComplexRouteParam(
|
var url = util.appendComplexRouteParam(
|
||||||
'#/post/' + post.id,
|
'#/post/' + post.id,
|
||||||
_.extend({page: page + direction}, pager.getSearchParams()));
|
_.extend({page: page + direction}, pager.getSearchParams()));
|
||||||
resolve(url);
|
resolve(url);
|
||||||
} else {
|
} else {
|
||||||
resolve(null);
|
resolve(null);
|
||||||
}
|
}
|
||||||
});
|
}).fail(function() {
|
||||||
|
reject();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
resolve(null);
|
resolve(null);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue