name:
src/main/js/errors/ExceptionHelpers.ts
-rw-r--r--
1126
1import { DivException } from "./DivException";
2import { AllF7ExceptionNames, F7ExceptionName } from "./F7ExceptionName";
3import { NAException } from "./NAException";
4import { NameException } from "./NameException";
5import { NullException } from "./NullException";
6import { NumException } from "./NumException";
7import { ParseException } from "./ParseException";
8import { RefException } from "./RefException";
9import { ValueException } from "./ValueException";
10
11export function f7ExceptionFromString(name: string) {
12 if (AllF7ExceptionNames.has(name as F7ExceptionName)) {
13 switch (name) {
14 case "#NULL!":
15 return new NullException("");
16 case "#DIV/0!":
17 return new DivException("");
18 case "#VALUE!":
19 return new ValueException("");
20 case "#REF!":
21 return new RefException("");
22 case "#NAME?":
23 return new NameException("");
24 case "#NUM!":
25 return new NumException("");
26 case "#N/A":
27 return new NAException("");
28 case "#ERROR!":
29 return new ParseException("");
30 default:
31 throw new ParseException("");
32 }
33 }
34}