mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user