Skip to content
This repository was archived by the owner on Sep 30, 2023. It is now read-only.

Commit 10c1dd3

Browse files
CSDUMMIaphelionz
authored andcommitted
No longer returned Promise.resolve/reject from async functions.
1 parent df1dd58 commit 10c1dd3

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/keystore.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,15 @@ class Keystore {
3737
}
3838

3939
async open () {
40-
if (this._store) {
41-
await this._store.open()
42-
return Promise.resolve()
40+
if (!this._store) {
41+
throw new Error('Keystore: No store found to open')
4342
}
44-
return Promise.reject(new Error('Keystore: No store found to open'))
43+
await this._store.open()
4544
}
4645

4746
async close () {
4847
if (!this._store) return
49-
await this._upgraded
48+
await this._upgrade()
5049
await this._store.close()
5150
}
5251

@@ -83,7 +82,7 @@ class Keystore {
8382
throw new Error('id needed to check a key')
8483
}
8584
if (this._store.status && this._store.status !== 'open') {
86-
return Promise.resolve(null)
85+
return null
8786
}
8887
if (!this._upgraded) {
8988
await this._upgrade()
@@ -106,7 +105,7 @@ class Keystore {
106105
throw new Error('id needed to create a key')
107106
}
108107
if (this._store.status && this._store.status !== 'open') {
109-
return Promise.resolve(null)
108+
return null
110109
}
111110
if (!this._upgraded) {
112111
await this._upgrade()
@@ -139,7 +138,7 @@ class Keystore {
139138
await this.open()
140139
}
141140
if (this._store.status && this._store.status !== 'open') {
142-
return Promise.resolve(null)
141+
return null
143142
}
144143
if (!this._upgraded) {
145144
await this._upgrade()

0 commit comments

Comments
 (0)