2013-03-05 18:06:52 +00:00
|
|
|
|
2013-03-10 03:02:07 +00:00
|
|
|
Elm.Native.Error = function(elm) {
|
|
|
|
'use strict';
|
|
|
|
elm.Native = elm.Native || {};
|
|
|
|
if (elm.Native.Error) return elm.Native.Error;
|
|
|
|
|
2013-03-12 07:48:11 +00:00
|
|
|
var fromString = Elm.Native.JavaScript(elm).fromString;
|
|
|
|
|
2013-03-10 03:02:07 +00:00
|
|
|
function Case(span) {
|
2013-03-05 18:06:52 +00:00
|
|
|
var msg = 'Non-exhaustive pattern match in case expression'
|
|
|
|
throw new Error(msg + " (" + span + ")")
|
|
|
|
}
|
2013-03-10 03:02:07 +00:00
|
|
|
|
|
|
|
function If(span) {
|
2013-03-05 18:06:52 +00:00
|
|
|
var msg = 'Non-exhaustive pattern match in multi-way-if expression'
|
|
|
|
throw new Error(msg + " (" + span + ")")
|
|
|
|
}
|
2013-03-10 03:02:07 +00:00
|
|
|
|
2013-03-12 07:48:11 +00:00
|
|
|
function raise(str) { throw new Error(fromString(str)); }
|
|
|
|
|
|
|
|
return elm.Native.Error = { Case: Case, If: If, raise: raise };
|
2013-03-05 18:06:52 +00:00
|
|
|
};
|