Skip to content

Commit

Permalink
clearer error when plugin is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Nov 17, 2020
1 parent 9007be0 commit b2e5493
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/utils/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const errors = {
18(plugin: string) {
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`
},
19: "plugin not loaded",
20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",
21(thing: string) {
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`
Expand Down
2 changes: 1 addition & 1 deletion src/utils/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function getPlugin<K extends keyof Plugins>(
): Exclude<Plugins[K], undefined> {
const plugin = plugins[pluginKey]
if (!plugin) {
die(__DEV__ ? 18 : 19, pluginKey)
die(18, pluginKey)
}
// @ts-ignore
return plugin
Expand Down

0 comments on commit b2e5493

Please sign in to comment.