Skip to content

Commit

Permalink
better error handle in import && remove console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
fengkx committed Dec 23, 2018
1 parent cd5f39a commit 743586a
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion database/initTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const initTables = async () => {
const sql = fs.readFileSync(__dirname + '/sql/create_tables.sql',
{encoding: 'utf-8'}
);
// console.log(sql)
const db = await dbPromise;
await Promise.all(sql.split(';\n').map(async (i) => {
if (i.trim().length !== 0)
Expand Down
1 change: 0 additions & 1 deletion middlewares/getFileLink.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = async (ctx, next) => {
console.log(ctx.message);
const fileId = ctx.message.document.file_id;
const fileLink = await ctx.telegram.getFileLink(fileId);
if (!!fileLink) {
Expand Down
2 changes: 1 addition & 1 deletion middlewares/importFromOpml.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = async (ctx, next) => {
ctx.state.outlines = outlines;
await Promise.all(outlines.map(async outline => {
try {
RSS.sub(ctx.chat.id, outline.xmlUrl, outline.text);
await RSS.sub(ctx.chat.id, outline.xmlUrl, outline.text);
} catch (e) {
if (e.message !== 'ALREADY_SUB') throw new Error('DB_ERROR');
}
Expand Down
1 change: 0 additions & 1 deletion middlewares/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const pm = {};
pm.isAdmin = async (ctx, next) => {
ctx.state.chat = await ctx.getChat();
const chat = ctx.state.chat;
// console.log(chat);
if (chat.type !== 'private') {
switch (chat.type) {
case 'group':
Expand Down
1 change: 0 additions & 1 deletion proxies/rssFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ px.sub = async (userId, feedUrl, feedTitle) => {
const feed = await db.get(`SELECT *
FROM rss_feed
WHERE url = ?`, [feedUrl]);
// console.log(feed)
if (!!feed) {
const sql = `SELECT *
FROM subscribes
Expand Down

0 comments on commit 743586a

Please sign in to comment.