Commit a4e7d83c authored by yPhil's avatar yPhil
Browse files

Better error messages

parent 004206e8
......@@ -535,17 +535,10 @@ PTL.dialog = {
e.preventDefault();
let feedUrl;
let feedUrl = DOMPurify.sanitize($feedAddInput.val());;
$('div#feedNewListDiv').empty();
if (url) {
feedUrl = DOMPurify.sanitize(url);
$feedAddInput.val(feedUrl);
} else {
feedUrl = DOMPurify.sanitize($feedAddInput.val());
}
if (feedUrl == '') {
PTL.dialog.feedAddError($dialog, feedUrl, 'empty');
return;
......
......@@ -48,7 +48,8 @@ function getFeed(feedUrl, lastItem, callback) {
}).then(function(res) {
if (res.status != 200) {
callback(formatError({type: res.type, status: res.status, message: res.message}));
console.error('whoaaaa: %o (%s)', res.statusText, feedUrl);
callback(formatError({type: res.type, status: res.status, message: res.statusText}));
}
var feedparser = new FeedParser();
......@@ -77,7 +78,7 @@ function getFeed(feedUrl, lastItem, callback) {
}).on('end', function() {
if (feedItems.length === 0) {
callback(formatError({ type: 'Empty feed', status: null, message: 'Feed OK, but empty' }));
callback(formatError({ type: 'Syntax', status: res.status, message: 'Feed OK, but empty' }));
}
var newLastItem;
......@@ -101,6 +102,7 @@ function getFeed(feedUrl, lastItem, callback) {
}).catch((error) => {
console.error('whopop: %s (%s)', error, feedUrl);
callback(formatError({type: error.type, status: error.status, message: error.message}));
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment