Skip to content

Commit df7d526

Browse files
committed
🐛 Fix: initailize db function error
1 parent 569e9a5 commit df7d526

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.eslintrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ module.exports = {
1717
}
1818
}
1919
],
20-
'@typescript-eslint/prefer-nullish-coalescing': 0
20+
'@typescript-eslint/prefer-nullish-coalescing': 0,
21+
'@typescript-eslint/return-await': 0,
22+
'@typescript-eslint/no-floating-promises': 0
2123
}
2224
}

src/utils/db.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,23 @@ class DB {
2020
this.db._.mixin(lodashId)
2121

2222
if (!this.db.has('picBed').value()) {
23-
this.db.set('picBed', {
24-
uploader: 'smms',
25-
current: 'smms'
26-
}).write().catch((e) => { this.ctx.log.error(e) })
23+
try {
24+
this.db.set('picBed', {
25+
uploader: 'smms',
26+
current: 'smms'
27+
}).write()
28+
} catch (e) {
29+
this.ctx.log.error(e)
30+
throw e
31+
}
2732
}
2833
if (!this.db.has('picgoPlugins').value()) {
29-
this.db.set('picgoPlugins', {}).write().catch((e) => { this.ctx.log.error(e) })
34+
try {
35+
this.db.set('picgoPlugins', {}).write()
36+
} catch (e) {
37+
this.ctx.log.error(e)
38+
throw e
39+
}
3040
}
3141
}
3242

0 commit comments

Comments
 (0)