formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.89k stars 1.06k forks source link

Evaluator should allow for exposing errors #4613

Closed paulfalgout closed 9 months ago

paulfalgout commented 2 years ago

I realize that the evaluate function appears to be trying to give context to where errors are occurring which is nice, but because they're all console.warn we aren't getting logs on our error services. And I don't want to override warn because some things are legitimately warnings.

I would actually prefer that an error is always an error, but perhaps this could be done with a flag like Evaluator.noEval that would do something like: Evaluator.warnOnError ? console.warn(...) : console.error(...);

For the moment my solution is to:

const evaluator = Formio.Evaluator.evaluator;
Formio.Evaluator.evaluator = function(func, ...params) {
  try {
    return evaluator(func, ...params);
  } catch (e) {
    console.error(e);
  }
};
daneformio commented 9 months ago

Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!

paulfalgout commented 9 months ago

So if it is still relevant is there any real point to reopening it, or will the issue go unaddressed and closed in a couple of years?

daneformio commented 8 months ago

Please re-open and provide an example of this issue in the latest versions and we'd be happy to review soon.