Display spreadsheet errors and disable math.js internal functions #3439
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



PR Summary
New Features
ErrorCellRenderercomponent to display#ERRORfor invalid formula results, with localized tooltip messages.math.tsto return structured validation errors instead of throwing exceptions.spreadsheet-en.tsandspreadsheet-fr.ts.Behavior Changes
column-mapper.ts:ErrorCellRendererwhen a formula result is invalid.isValidationResultto determine cell rendering behavior through AG gridcellRendererSelectorpropWhen both occur, forbidden math.js errors take priority (can be changed).
Other
import,parse,simplify, etc.) now return validation errors instead of exceptions.Going Further
This system can be incremented on to handle more math.js resolution errors by tweaking the
createValueGetterfunction.In particular, additional error thrown during formula evaluation can be caught in its
catchblock and returned as aValidationResult. This would allow theErrorCellRendererto display consistent error feedback for a wider range of math.js errors.Additionnaly the
ErrorCellRenderercould be specialized to display a diferent code depending on the type of caught error