Skip to content

Commit

Permalink
duplicate error message so it can get mangled
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed Feb 12, 2024
1 parent 2718c97 commit a060b45
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/toolkit/src/query/createApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,17 @@ export function buildCreateApi<Modules extends [Module<any>, ...Module<any>[]]>(
inject.overrideExisting !== true &&
endpointName in context.endpointDefinitions
) {
const errorMessage = `called \`injectEndpoints\` to override already-existing endpointName ${endpointName} without specifying \`overrideExisting: true\``
if (inject.overrideExisting === 'throw') {
throw new Error(errorMessage)
throw new Error(
`called \`injectEndpoints\` to override already-existing endpointName ${endpointName} without specifying \`overrideExisting: true\``,
)
} else if (
typeof process !== 'undefined' &&
process.env.NODE_ENV === 'development'
) {
console.error(errorMessage)
console.error(
`called \`injectEndpoints\` to override already-existing endpointName ${endpointName} without specifying \`overrideExisting: true\``,
)
}

continue
Expand Down

0 comments on commit a060b45

Please sign in to comment.