From 158381dfbbc21e18b9856885459131b8ad4d0aa3 Mon Sep 17 00:00:00 2001 From: Umur Ozkul Date: Wed, 30 Mar 2022 11:06:30 +0200 Subject: [PATCH] PR#107 --- .../Reducer/Reducer_MathJs/Reducer_MathJsEval_test.res | 2 +- .../Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn.res | 2 +- .../squiggle-lang/src/rescript/Reducer/Reducer_ErrorValue.res | 4 ++-- .../rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Eval.res | 2 +- .../rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Parse.res | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_MathJs/Reducer_MathJsEval_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_MathJs/Reducer_MathJsEval_test.res index 4b260ddf..355c69ea 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_MathJs/Reducer_MathJsEval_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_MathJs/Reducer_MathJsEval_test.res @@ -20,7 +20,7 @@ describe("errors", () => { // All those errors propagete up and are returned by the resolver test("unknown function", () => expect(MathJs.Eval.eval("testZadanga()"))->toEqual( - Error(ErrorValue.REJs(Some("Undefined function testZadanga"), Some("Error"))), + Error(ErrorValue.REJavaScriptExn(Some("Undefined function testZadanga"), Some("Error"))), ) ) diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn.res index a6ff353c..0a84f876 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn.res @@ -67,6 +67,6 @@ let dispatch = (call: functionCall): result => // So we have to recreate a copy of the string ExternalLibrary.dispatch((Js.String.make(fn), args), callInternal) } catch { - | Js.Exn.Error(obj) => REJs(Js.Exn.message(obj), Js.Exn.name(obj))->Error + | Js.Exn.Error(obj) => REJavaScriptExn(Js.Exn.message(obj), Js.Exn.name(obj))->Error | _ => RETodo("unhandled rescript exception")->Error } diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_ErrorValue.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_ErrorValue.res index 3b318083..d026765d 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_ErrorValue.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_ErrorValue.res @@ -1,7 +1,7 @@ type errorValue = | REArrayIndexNotFound(string, int) | REFunctionExpected(string) - | REJs(option, option) // Javascript Exception + | REJavaScriptExn(option, option) // Javascript Exception | RERecordPropertyNotFound(string, string) | RETodo(string) // To do @@ -9,7 +9,7 @@ let showError = err => switch err { | REArrayIndexNotFound(msg, index) => `${msg}: ${Js.String.make(index)}` | REFunctionExpected(msg) => `Function expected: ${msg}` - | REJs(omsg, oname) => { + | REJavaScriptExn(omsg, oname) => { let answer = "JS Exception:" let answer = switch oname { | Some(name) => `${answer} ${name}` diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Eval.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Eval.res index b99a3201..94a1834c 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Eval.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Eval.res @@ -22,6 +22,6 @@ let eval = (expr: string): result => { let answer = eval__(expr) answer["value"]->JavaScript.Gate.jsToEv } catch { - | Js.Exn.Error(obj) => REJs(Js.Exn.message(obj), Js.Exn.name(obj))->Error + | Js.Exn.Error(obj) => REJavaScriptExn(Js.Exn.message(obj), Js.Exn.name(obj))->Error } } diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Parse.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Parse.res index 26484cf4..2eb88129 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Parse.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Parse.res @@ -44,7 +44,7 @@ let parse = (expr: string): result => try { Ok(parse__(expr)) } catch { - | Js.Exn.Error(obj) => REJs(Js.Exn.message(obj), Js.Exn.name(obj))->Error + | Js.Exn.Error(obj) => REJavaScriptExn(Js.Exn.message(obj), Js.Exn.name(obj))->Error } type mathJsNode =