Skip to content

Commit

Permalink
🐛 Fix: initailize db function error
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Jul 5, 2020
1 parent 569e9a5 commit df7d526
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module.exports = {
}
}
],
'@typescript-eslint/prefer-nullish-coalescing': 0
'@typescript-eslint/prefer-nullish-coalescing': 0,
'@typescript-eslint/return-await': 0,
'@typescript-eslint/no-floating-promises': 0
}
}
20 changes: 15 additions & 5 deletions src/utils/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,23 @@ class DB {
this.db._.mixin(lodashId)

if (!this.db.has('picBed').value()) {
this.db.set('picBed', {
uploader: 'smms',
current: 'smms'
}).write().catch((e) => { this.ctx.log.error(e) })
try {
this.db.set('picBed', {
uploader: 'smms',
current: 'smms'
}).write()
} catch (e) {
this.ctx.log.error(e)
throw e
}
}
if (!this.db.has('picgoPlugins').value()) {
this.db.set('picgoPlugins', {}).write().catch((e) => { this.ctx.log.error(e) })
try {
this.db.set('picgoPlugins', {}).write()
} catch (e) {
this.ctx.log.error(e)
throw e
}
}
}

Expand Down

0 comments on commit df7d526

Please sign in to comment.