(core) Add CellError to explain when a formula refers to a cell with an error value

Summary:
get_cell_value wraps RaisedException with CellError to expand the error message for the user.

This is still pretty conceptual, the comments explain some things to think about, but it works and is an improvement.

Test Plan: Updated Python unit tests

Reviewers: dsagal, paulfitz

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2928
This commit is contained in:
Alex Hall
2021-07-30 20:51:56 +02:00
parent 1605e18f66
commit 0e5c2bee59
4 changed files with 51 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ import six
import column
from functions import date # pylint: disable=import-error
from functions.unimplemented import unimplemented
from objtypes import CellError
from usertypes import AltText # pylint: disable=import-error
from records import Record, RecordSet
@@ -597,6 +598,9 @@ def _prepare_record_dict(record, dates_as_iso=False, expand_refs=0):
result[col_id] = val
except Exception as e:
result[col_id] = None
while isinstance(e, CellError):
# The extra information from CellError is redundant here
e = e.error # pylint: disable=no-member
errors[col_id] = "%s: %s" % (type(e).__name__, str(e))
if errors: