Skip to content

Commit 8c7365a

Browse files
committed
Fix no-throw-literal warning
1 parent d8569c7 commit 8c7365a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/createAsyncThunk.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,11 @@ If you want to use the AbortController to react to \`abort\` events, please cons
339339
options.condition &&
340340
options.condition(arg, { getState, extra }) === false
341341
) {
342-
throw {
343-
name: 'ConditionError',
344-
message: 'Aborted due to condition callback returning false.'
345-
}
342+
const err = new Error(
343+
'Aborted due to condition callback returning false.'
344+
)
345+
err.name = 'ConditionError'
346+
throw err
346347
}
347348
dispatch(pending(requestId, arg))
348349
finalAction = await Promise.race([

0 commit comments

Comments
 (0)