Skip to content

Commit cf6a2e9

Browse files
committed
Make backtick usages in error messages consistent
1 parent 2510a32 commit cf6a2e9

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

errors.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"0": "prepareAction did not return an object",
3-
"1": "\"reducer\" is a required argument, and must be a function or an object of functions that can be passed to combineReducers",
4-
"2": "\"middleware\" field must be a callback",
3+
"1": "`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers",
4+
"2": "`middleware` field must be a callback",
55
"3": "when using a middleware builder function, an array of middleware must be returned",
66
"4": "each middleware provided to configureStore must be a function",
7-
"5": "\"enhancers\" field must be a callback",
8-
"6": "\"enhancers\" callback must return an array",
7+
"5": "`enhancers` field must be a callback",
8+
"6": "`enhancers` callback must return an array",
99
"7": "each enhancer provided to configureStore must be a function",
1010
"8": "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer",
1111
"9": "A case reducer on a non-draftable value must not return undefined",
@@ -28,7 +28,7 @@
2828
"26": "`builder.addCase` should only be called before calling `builder.addMatcher`",
2929
"27": "`builder.addCase` should only be called before calling `builder.addDefaultCase`",
3030
"28": "`builder.addCase` cannot be called with an empty action type",
31-
"29": "\\`builder.addCase\\` cannot be called with two reducers for the same action type ''",
31+
"29": "`builder.addCase` cannot be called with two reducers for the same action type ''",
3232
"30": "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`",
3333
"31": "`builder.addDefaultCase` can only be called once",
3434
"32": " is not a function",
@@ -38,4 +38,4 @@
3838
"36": "When using custom hooks for context, all hooks need to be provided: .\\nHook was either not provided or not a function.",
3939
"37": "Warning: Middleware for RTK-Query API at reducerPath \"\" has not been added to the store.\n You must add the middleware for RTK-Query to function correctly!",
4040
"38": "Cannot refetch a query that has not been started yet."
41-
}
41+
}

packages/toolkit/src/configureStore.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ export function configureStore<
140140
rootReducer = combineReducers(reducer) as unknown as Reducer<S, A, P>
141141
} else {
142142
throw new Error(
143-
'"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers'
143+
'`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers'
144144
)
145145
}
146146

147147
if (!IS_PRODUCTION && middleware && typeof middleware !== 'function') {
148-
throw new Error('"middleware" field must be a callback')
148+
throw new Error('`middleware` field must be a callback')
149149
}
150150

151151
let finalMiddleware: Tuple<Middlewares<S>>
@@ -184,7 +184,7 @@ export function configureStore<
184184
const getDefaultEnhancers = buildGetDefaultEnhancers<M>(middlewareEnhancer)
185185

186186
if (!IS_PRODUCTION && enhancers && typeof enhancers !== 'function') {
187-
throw new Error('"enhancers" field must be a callback')
187+
throw new Error('`enhancers` field must be a callback')
188188
}
189189

190190
let storeEnhancers =
@@ -193,7 +193,7 @@ export function configureStore<
193193
: getDefaultEnhancers()
194194

195195
if (!IS_PRODUCTION && !Array.isArray(storeEnhancers)) {
196-
throw new Error('"enhancers" callback must return an array')
196+
throw new Error('`enhancers` callback must return an array')
197197
}
198198
if (
199199
!IS_PRODUCTION &&

packages/toolkit/src/mapBuilders.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ export function executeReducerBuilderCallback<S>(
166166
}
167167
if (type in actionsMap) {
168168
throw new Error(
169-
`\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`
169+
'`builder.addCase` cannot be called with two reducers for the same action type ' +
170+
`'${type}'`
170171
)
171172
}
172173
actionsMap[type] = reducer

0 commit comments

Comments
 (0)