From 5d1730101612a8575fcba7c3151f1fac16faab1a Mon Sep 17 00:00:00 2001 From: Umur Ozkul Date: Fri, 9 Sep 2022 01:14:42 +0200 Subject: [PATCH] remove raise --- .../Reducer/Reducer_Expression/Reducer_Expression.res | 2 -- .../Reducer_Expression/Reducer_Expression_Lambda.res | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression.res index ea810c88..e3fdf168 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression.res @@ -14,8 +14,6 @@ module T = Reducer_Expression_T type errorValue = Reducer_ErrorValue.errorValue type t = T.t -exception ErrorException = Reducer_ErrorValue.ErrorException - /* Recursively evaluate/reduce the expression (Lisp AST/Lambda calculus) */ diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_Lambda.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_Lambda.res index c4ef011e..aa0745ae 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_Lambda.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_Lambda.res @@ -23,7 +23,7 @@ let checkArity = ( let argsLength = Belt.List.length(args) let parametersLength = Js.Array2.length(lambdaValue.parameters) if argsLength !== parametersLength { - raise(ErrorValue.ErrorException(ErrorValue.REArityError(None, parametersLength, argsLength))) + ErrorValue.REArityError(None, parametersLength, argsLength)->ErrorValue.toException } else { args } @@ -38,7 +38,7 @@ let checkArity = ( let checkIfReduced = (args: list) => args->Belt.List.reduceReverse(list{}, (acc, arg) => switch arg { - | IEvSymbol(symbol) => raise(ErrorValue.ErrorException(ErrorValue.RESymbolNotFound(symbol))) + | IEvSymbol(symbol) => ErrorValue.RESymbolNotFound(symbol)->ErrorValue.toException | _ => list{arg, ...acc} } ) @@ -63,7 +63,7 @@ let caseNotFFI = ( let caseFFI = (ffiFn: ExpressionT.ffiFn, args, accessors: ProjectAccessorsT.t) => { switch ffiFn(args->Belt.List.toArray, accessors.environment) { | Ok(value) => value - | Error(value) => raise(ErrorValue.ErrorException(value)) + | Error(value) => value->ErrorValue.toException } }