Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
rozzilla committed Apr 23, 2024
1 parent ce63955 commit 785b09b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion asyncforge.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function memo (name) {
function get () {
const store = asyncLocalStorage.getStore()
if (!store) {
throw new Error('asyncforge store is not initialized')
throw new Error(`asyncforge store is not initialized for ${name}`)
}
return store[sym]
}
Expand Down
4 changes: 2 additions & 2 deletions test/do-not-start-memo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('memo without start', async (t) => {
const p = tspl(t, { plan: 6 })
const a = memo()

p.throws(() => a())
p.throws(() => a(), { message: 'asyncforge store is not initialized for memo0' })
a.set({ value: 'bar' })
p.deepStrictEqual(a(), { value: 'bar' })

Expand Down Expand Up @@ -42,7 +42,7 @@ test('nested', async (t) => {
const p = tspl(t, { plan: 5 })
const a = memo()

p.throws(() => a())
p.throws(() => a(), { message: 'asyncforge store is not initialized for memo1' })
a.set({ value: 'bar' })
p.deepStrictEqual(a(), { value: 'bar' })

Expand Down

0 comments on commit 785b09b

Please sign in to comment.