ergo icon indicating copy to clipboard operation
ergo copied to clipboard

Align Ergo throw/enforce errors with the standard Accord Project Error hierarchy

Open jeromesimeon opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe. When a clause throws an error (either through an enforce expression or as an explicit throw in the logic), that error is caught after logic execution and turned into a low-level JavaScript error with a string.

It would be nice if the error being thrown in JavaScript was made part of the standard Accord Project error model (see https://docs.accordproject.org/docs/ref-errors.html).

The code is currently located in the Ergo runtime here: https://github.com/accordproject/ergo/blob/7e8a92585303e4a48c897b427f8231bac9cda478/backends/javascript/ergo-runtime.js#L851

Describe the solution you'd like A new kind of Accord Project exception for Logic errors (LogicException ?) in https://docs.accordproject.org/docs/ref-errors.html.

Change the runtime behaviour to raise one of those.

Maybe better location information, and details notably for enforce exceptions.

jeromesimeon avatar Apr 13 '20 15:04 jeromesimeon