Skip to content

Commit

Permalink
Update errors, adding one for "overlapping Elm module names"
Browse files Browse the repository at this point in the history
  • Loading branch information
evancz committed Dec 15, 2017
1 parent be27dfe commit 71b4bc4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
18 changes: 18 additions & 0 deletions hints/6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Problem

The application you are using ran into a problem.

If you let their support team know about this error, please give them a link to this web page as well!


<br>

## Info for Developers

This page loads multiple Elm scripts. It then puts the publicly exposed modules from each script on the global `Elm` object. The problem is that there is a name clash.

For example, script `a.js` may expose an Elm module named `Main`, and script `b.js` may expose an Elm module named `Main`. Elm cannot know which one to use! So they need to have unique names if you need them to be added to the global `Elm` object.

Maybe a duplicate script is getting loaded accidentally? Anyway, if you reproduce this error in dev mode, it will tell you the module name that is getting added more than once.

Hopefully that helps!
16 changes: 0 additions & 16 deletions hints/7.md

This file was deleted.

6 changes: 2 additions & 4 deletions src/Elm/Kernel/Error.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ function _Error_throw__DEBUG(identifier, fact1, fact2, fact3, fact4)
throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at http://package.elm-lang.org/packages/elm-lang/core/latest/Basics#== which describes why it is this way and what the better version will look like.');

case 6:
throw new Error('Comparison error: cannot compare tuples with more than 6 elements.');

case 7:
throw new Error('Comparison error: comparison is only defined on ints, floats, times, chars, strings, lists of comparable values, and tuples of comparable values.');
var moduleName = fact1;
throw new Error('Your page is loading multiple Elm scripts with a module named ' + moduleName + '. Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!');

case 8:
var moduleName = fact1;
Expand Down

0 comments on commit 71b4bc4

Please sign in to comment.