f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/main/js/errors/F7ExceptionName.ts
-rw-r--r--
1431
 1export enum F7ExceptionName {
 2  DIV = "#DIV/0!",
 3  VALUE = "#VALUE!",
 4  REF = "#REF!",
 5  NAME = "#NAME?",
 6  NUM = "#NUM!",
 7  NULL = "#NULL!",
 8  NA = "#N/A",
 9  PARSE = "#ERROR!",
10}
11
12export const AllF7ExceptionNames = new Set([
13  F7ExceptionName.DIV,
14  F7ExceptionName.VALUE,
15  F7ExceptionName.REF,
16  F7ExceptionName.NAME,
17  F7ExceptionName.NUM,
18  F7ExceptionName.NULL,
19  F7ExceptionName.NA,
20  F7ExceptionName.PARSE,
21]);
22
23export function getExceptionCode(exception: F7ExceptionName): number {
24  switch (exception) {
25    case F7ExceptionName.NULL:
26      return 1;
27    case F7ExceptionName.DIV:
28      return 2;
29    case F7ExceptionName.VALUE:
30      return 3;
31    case F7ExceptionName.REF:
32      return 4;
33    case F7ExceptionName.NAME:
34      return 5;
35    case F7ExceptionName.NUM:
36      return 6;
37    case F7ExceptionName.NA:
38      return 7;
39    case F7ExceptionName.PARSE:
40      return 8;
41    default:
42      return 0;
43  }
44}
45
46export function getExceptionValue(exception: F7ExceptionName): number {
47  switch (exception) {
48    case F7ExceptionName.NULL:
49      return 0;
50    case F7ExceptionName.DIV:
51      return 7;
52    case F7ExceptionName.VALUE:
53      return 15;
54    case F7ExceptionName.REF:
55      return 23;
56    case F7ExceptionName.NAME:
57      return 29;
58    case F7ExceptionName.NUM:
59      return 36;
60    case F7ExceptionName.NA:
61      return 42;
62    case F7ExceptionName.PARSE:
63      return 0;
64    default:
65      return 0;
66  }
67}