spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
[Sheet] just letting the cell containing the error return...
author
Ben Vogt <[email protected]>
date
2017-09-04 19:12:00
stats
2 file(s) changed, 11 insertions(+), 4 deletions(-)
files
src/Sheet.ts
tests/SheetFormulaTest.ts
 1diff --git a/src/Sheet.ts b/src/Sheet.ts
 2index b79db5b..de3d952 100644
 3--- a/src/Sheet.ts
 4+++ b/src/Sheet.ts
 5@@ -474,10 +474,10 @@ let Sheet = (function () {
 6           throw new RefError("Reference does not exist.");
 7         }
 8       }
 9-      // check if any error occurs
10-      if (!cell.isBlank() && cell.getError()) {
11-        throw cell.getError();
12-      }
13+      // // check if any error occurs
14+      // if (!cell.isBlank() && cell.getError()) {
15+      //   throw cell.getError();
16+      // }
17       return cell;
18     },
19 
20diff --git a/tests/SheetFormulaTest.ts b/tests/SheetFormulaTest.ts
21index 8f5ccd9..8baa2ce 100644
22--- a/tests/SheetFormulaTest.ts
23+++ b/tests/SheetFormulaTest.ts
24@@ -968,10 +968,17 @@ test("Sheet TO_TEXT", function(){
25 });
26 
27 test("Sheet ERROR.TYPE", function(){
28+
29   let sheet = new Sheet();
30   sheet.setCell("M1", "= 1/0");
31   sheet.setCell("A1", "=ERROR.TYPE(M1)");
32   assertEquals(sheet.getCell("A1").getValue(), 2);
33+
34+  // Divide by zero error should be caught by formula
35+  assertFormulaEquals('=ERROR.TYPE(1/0)', 2);
36+
37+  // Parse error should bubble up to cell
38+  assertFormulaEqualsError('=ERROR.TYPE(10e)', PARSE_ERROR);
39 });
40 
41 test("Sheet parsing error", function(){