|
1 | | -import { AbortState } from "./abort"; |
2 | | -import { ErrorState } from "./error"; |
| 1 | +import { __AbortState } from "./abort"; |
| 2 | +import { __ErrorState } from "./error"; |
3 | 3 |
|
4 | | -export enum ExceptionType { |
| 4 | +export enum __ExceptionType { |
5 | 5 | None, |
6 | 6 | Abort, |
7 | 7 | Error, |
8 | 8 | Unreachable, |
9 | 9 | } |
10 | 10 |
|
11 | | -export namespace ExceptionState { |
| 11 | +export namespace __ExceptionState { |
12 | 12 | export let Failed: boolean = false; |
13 | | - export let Type: ExceptionType = ExceptionType.None; |
| 13 | + export let Type: __ExceptionType = __ExceptionType.None; |
14 | 14 | } |
15 | 15 |
|
16 | | -export class Exception { |
17 | | - public type: ExceptionType; |
| 16 | +export class __Exception { |
| 17 | + public type: __ExceptionType; |
18 | 18 | // Abort |
19 | | - public msg: string | null = AbortState.msg; |
20 | | - public fileName: string | null = AbortState.fileName; |
21 | | - public lineNumber: i32 = AbortState.lineNumber; |
22 | | - public columnNumber: i32 = AbortState.columnNumber; |
| 19 | + public msg: string | null = __AbortState.msg; |
| 20 | + public fileName: string | null = __AbortState.fileName; |
| 21 | + public lineNumber: i32 = __AbortState.lineNumber; |
| 22 | + public columnNumber: i32 = __AbortState.columnNumber; |
23 | 23 |
|
24 | 24 | // Error |
25 | | - public message: string = ErrorState.message; |
26 | | - public name: string = ErrorState.name; |
27 | | - public stack: string | null = ErrorState.stack; |
| 25 | + public message: string = __ErrorState.message; |
| 26 | + public name: string = __ErrorState.name; |
| 27 | + public stack: string | null = __ErrorState.stack; |
28 | 28 |
|
29 | | - constructor(type: ExceptionType) { |
| 29 | + constructor(type: __ExceptionType) { |
30 | 30 | this.type = type; |
31 | 31 | } |
32 | 32 | toString(): string { |
33 | 33 | let out = ""; |
34 | | - if (this.type == ExceptionType.Abort) { |
| 34 | + if (this.type == __ExceptionType.Abort) { |
35 | 35 | out = "abort"; |
36 | | - if (AbortState.msg) out += ": " + AbortState.msg!; |
37 | | - if (AbortState.fileName) out += " in " + AbortState.fileName!; |
38 | | - if (AbortState.lineNumber) |
39 | | - out += ` in (${AbortState.lineNumber}:${AbortState.columnNumber})`; |
40 | | - } else if (this.type == ExceptionType.Unreachable) { |
| 36 | + if (__AbortState.msg) out += ": " + __AbortState.msg!; |
| 37 | + if (__AbortState.fileName) out += " in " + __AbortState.fileName!; |
| 38 | + if (__AbortState.lineNumber) |
| 39 | + out += ` in (${__AbortState.lineNumber}:${__AbortState.columnNumber})`; |
| 40 | + } else if (this.type == __ExceptionType.Unreachable) { |
41 | 41 | out = "unreachable"; |
42 | | - } else if (this.type == ExceptionType.Error) { |
43 | | - out = "Error: " + ErrorState.message; |
| 42 | + } else if (this.type == __ExceptionType.Error) { |
| 43 | + out = "Error: " + __ErrorState.message; |
44 | 44 | } |
45 | 45 | return out; |
46 | 46 | } |
|
0 commit comments