on master help sign in
And a few more places with bad throws.
commit30319a3425ef58e35b2a4e145c1940c8e80c14d4 authorDobes Vandermeer <dobesv@gmail.com> dateTue 29 Jan 2013, 12:47 (14 years ago) parent258519a
3 files changed+9−9
core-js/Graphics/Element.js+2−2 core-js/List.js+6−6 core-js/Prelude.js+1−1
core-js/Graphics/Element.js+2−2
@@ -481,7 +481,7 @@ Elm.Graphics = function() {
481481 var case1 = case0[1], case2 = case0[2], case3 = case0[3], case4 = case0[4];
482482 return Form_84(t_212 + case1)(case2)(case3)(case4)
483483 }
484− throw"Non-exhaustive pattern match in case";
484+ throw new Error("Non-exhaustive pattern match in case");
485485 }(Form$thetascaleposform_213)
486486 }
487487 }
@@ -505,7 +505,7 @@ Elm.Graphics = function() {
505505 }
506506 break
507507 }
508− throw"Non-exhaustive pattern match in case";
508+ throw new Error("Non-exhaustive pattern match in case");
509509 }(Form$thetascaleTuple2$pxpyform_226)
510510 }
511511 }
core-js/List.js+6−6
@@ -1,7 +1,7 @@
11Elm.List = function() {
22
33 var throwError = function(f) {
4− throw "Function '" + f + "' expecting a list!";
4+ throw new Error("Function '" + f + "' expecting a list!");
55 }
66
77 function length(xs) {
@@ -46,19 +46,19 @@ Elm.List = function() {
4646 var minimum = foldl1(function(x) { return function(y) { return Math.min(x,y) } });
4747 function head(v) {
4848 if (v[0] !== "Cons") {
49− throw "Error: 'head' only accepts lists of length greater than one.";
49+ throw new Error("Error: 'head' only accepts lists of length greater than one.");
5050 }
5151 return v[1];
5252 }
5353 function tail(v) {
5454 if (v[0] !== "Cons") {
55− throw "Error: 'tail' only accepts lists of length greater than one.";
55+ throw new Error("Error: 'tail' only accepts lists of length greater than one.");
5656 }
5757 return v[2];
5858 }
5959 function last(v) {
6060 if (v[0] !== "Cons") {
61− throw "Error: 'last' only accepts lists of length greater than one.";
61+ throw new Error("Error: 'last' only accepts lists of length greater than one.");
6262 }
6363 var out = v[1];
6464 while (v[0] === "Cons") {
@@ -129,7 +129,7 @@ Elm.List = function() {
129129 }
130130 function foldr1(f) {
131131 return function(xs) {
132− if (xs[0] === "Nil") { throw "'foldr1' requires an non-empty list." }
132+ if (xs[0] === "Nil") { throw new Error("'foldr1' requires an non-empty list.") }
133133 if (xs[0] !== "Cons") { throwError('foldr1'); }
134134 var arr = [];
135135 while (xs[0] === "Cons") {
@@ -165,7 +165,7 @@ Elm.List = function() {
165165 function scanl1(f) {
166166 return function(xs) {
167167 if (xs[0] !== "Cons") {
168− throw "Error: 'scanl1' requires a list of at least length 1.";
168+ throw new Error("Error: 'scanl1' requires a list of at least length 1.");
169169 }
170170 return scanl(f)(xs[1])(xs[2]);
171171 }
core-js/Prelude.js+1−1
@@ -37,7 +37,7 @@ Elm.Prelude = function() {
3737 };
3838 var uncurry = function(f) { return function(p) {
3939 if (p[0] !== "Tuple2") {
40− throw "Function was uncurry'd but was not given a pair.";
40+ throw new Error("Function was uncurry'd but was not given a pair.");
4141 }
4242 return f(p[1])(p[2]); };
4343 };