Skip to content

Commit

Permalink
fix: fix error handling in import opml
Browse files Browse the repository at this point in the history
  • Loading branch information
fengkx committed Jul 10, 2019
1 parent 0908643 commit 385d1de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion middlewares/import-from-opml.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = async (ctx, next) => {
outline.text
);
} catch (e) {
if (e.message !== 'ALREADY_SUB')
if (e.code !== 'ALREADY_SUB')
// ignore feed already sub
throw errors.newCtrlErr('DB_ERROR', e);
}
Expand All @@ -57,6 +57,8 @@ module.exports = async (ctx, next) => {
} catch (e) {
if (e.response) {
throw errors.newCtrlErr('NETWORK_ERROR', e);
} else if (e instanceof errors.ControllableError) {
throw e;
} else {
throw errors.newCtrlErr('OPML_PARSE_ERRO', e);
}
Expand Down

0 comments on commit 385d1de

Please sign in to comment.