And a few more places with bad throws.

This commit is contained in:
Dobes Vandermeer 2013-01-29 12:47:55 -08:00
parent 258519a999
commit 30319a3425
3 changed files with 9 additions and 9 deletions

View File

@ -481,7 +481,7 @@ Elm.Graphics = function() {
var case1 = case0[1], case2 = case0[2], case3 = case0[3], case4 = case0[4];
return Form_84(t_212 + case1)(case2)(case3)(case4)
}
throw"Non-exhaustive pattern match in case";
throw new Error("Non-exhaustive pattern match in case");
}(Form$thetascaleposform_213)
}
}
@ -505,7 +505,7 @@ Elm.Graphics = function() {
}
break
}
throw"Non-exhaustive pattern match in case";
throw new Error("Non-exhaustive pattern match in case");
}(Form$thetascaleTuple2$pxpyform_226)
}
}

View File

@ -1,7 +1,7 @@
Elm.List = function() {
var throwError = function(f) {
throw "Function '" + f + "' expecting a list!";
throw new Error("Function '" + f + "' expecting a list!");
}
function length(xs) {
@ -46,19 +46,19 @@ Elm.List = function() {
var minimum = foldl1(function(x) { return function(y) { return Math.min(x,y) } });
function head(v) {
if (v[0] !== "Cons") {
throw "Error: 'head' only accepts lists of length greater than one.";
throw new Error("Error: 'head' only accepts lists of length greater than one.");
}
return v[1];
}
function tail(v) {
if (v[0] !== "Cons") {
throw "Error: 'tail' only accepts lists of length greater than one.";
throw new Error("Error: 'tail' only accepts lists of length greater than one.");
}
return v[2];
}
function last(v) {
if (v[0] !== "Cons") {
throw "Error: 'last' only accepts lists of length greater than one.";
throw new Error("Error: 'last' only accepts lists of length greater than one.");
}
var out = v[1];
while (v[0] === "Cons") {
@ -129,7 +129,7 @@ Elm.List = function() {
}
function foldr1(f) {
return function(xs) {
if (xs[0] === "Nil") { throw "'foldr1' requires an non-empty list." }
if (xs[0] === "Nil") { throw new Error("'foldr1' requires an non-empty list.") }
if (xs[0] !== "Cons") { throwError('foldr1'); }
var arr = [];
while (xs[0] === "Cons") {
@ -165,7 +165,7 @@ Elm.List = function() {
function scanl1(f) {
return function(xs) {
if (xs[0] !== "Cons") {
throw "Error: 'scanl1' requires a list of at least length 1.";
throw new Error("Error: 'scanl1' requires a list of at least length 1.");
}
return scanl(f)(xs[1])(xs[2]);
}

View File

@ -37,7 +37,7 @@ Elm.Prelude = function() {
};
var uncurry = function(f) { return function(p) {
if (p[0] !== "Tuple2") {
throw "Function was uncurry'd but was not given a pair.";
throw new Error("Function was uncurry'd but was not given a pair.");
}
return f(p[1])(p[2]); };
};