From 71b4bc402f63274f09ca8a058ef74c606ae74ec4 Mon Sep 17 00:00:00 2001 From: Evan Czaplicki Date: Thu, 14 Dec 2017 17:35:32 -0800 Subject: [PATCH] Update errors, adding one for "overlapping Elm module names" --- hints/6.md | 18 ++++++++++++++++++ hints/7.md | 16 ---------------- src/Elm/Kernel/Error.js | 6 ++---- 3 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 hints/6.md delete mode 100644 hints/7.md diff --git a/hints/6.md b/hints/6.md new file mode 100644 index 00000000..2a94d855 --- /dev/null +++ b/hints/6.md @@ -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! + + +
+ +## 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! diff --git a/hints/7.md b/hints/7.md deleted file mode 100644 index 432d0a6a..00000000 --- a/hints/7.md +++ /dev/null @@ -1,16 +0,0 @@ -# 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! - - -
- -## Info for Developers - -Your application does a bad comparison. Comparison is only defined on ints, floats, times, chars, strings, lists of comparable values, and tuples of comparable values. It looks like some other kinds of values got compared somehow. The root cause may be in your code or in a dependency. - -You can get more detailed information on when this happens if you can reproduce the error in dev mode. - -Hopefully that helps! diff --git a/src/Elm/Kernel/Error.js b/src/Elm/Kernel/Error.js index 02372af1..8771f867 100644 --- a/src/Elm/Kernel/Error.js +++ b/src/Elm/Kernel/Error.js @@ -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;