mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Render unmarshallable values as non-errors, using their repr() strings.
Summary: - Instead of sending an "UnmarshallableError" as an exception, introduce an "Unmarshallable" type of value, represented as ['U', repr(value)] - Unmarshallable values are rendered using a bluish text color, no longer a pink background. - Factor out ErrorDom to be simpler and cleaner. - Add GristObjCode enum, and simplify related helpers. - Use safe_repr() for when repr() itself fails - Handle conversion errors using safe_repr() when str() fails Test Plan: Added a test case based on a fixture covering a bunch of cases. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2584
This commit is contained in:
@@ -22,6 +22,7 @@ export function formatObject(args: [string, ...any[]]): string {
|
||||
case 'd': return moment.tz(objArgs[0] * 1000, 'UTC').format("YYYY-MM-DD");
|
||||
case 'R': return `${objArgs[0]}[${objArgs[1]}]`;
|
||||
case 'E': return gristTypes.formatError(args);
|
||||
case 'U': return String(args[1]);
|
||||
case 'P': return PENDING_DATA_PLACEHOLDER;
|
||||
}
|
||||
return objType + "(" + JSON.stringify(objArgs).slice(1, -1) + ")";
|
||||
|
||||
Reference in New Issue
Block a user