Skip to content

Conversation

@Meklo
Copy link
Contributor

@Meklo Meklo commented Nov 5, 2025

PR Summary

New Features

  • Added ErrorCellRenderer component to display #ERROR for invalid formula results, with localized tooltip messages.
  • Updated math.ts to return structured validation errors instead of throwing exceptions.
  • Added new translation keys for formula related errors in spreadsheet-en.ts and spreadsheet-fr.ts.

Behavior Changes

  • column-mapper.ts:
    • Uses ErrorCellRenderer when a formula result is invalid.
    • Uses isValidationResult to determine cell rendering behavior through AG grid cellRendererSelector prop
  • Typing validation errors (e.g., wrong data type returned by a formula) are now displayed in cells alongside forbidden math.js function errors.
    When both occur, forbidden math.js errors take priority (can be changed).

Other

  • Disabled math.js functions (import, parse, simplify, etc.) now return validation errors instead of exceptions.
  • Added corresponding error message translations.

Going Further

This system can be incremented on to handle more math.js resolution errors by tweaking the createValueGetter function.
In particular, additional error thrown during formula evaluation can be caught in its catch block and returned as a ValidationResult. This would allow the ErrorCellRenderer to display consistent error feedback for a wider range of math.js errors.

Additionnaly the ErrorCellRenderer could be specialized to display a diferent code depending on the type of caught error

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 5, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants