-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathError.cs
More file actions
98 lines (81 loc) · 2.17 KB
/
Error.cs
File metadata and controls
98 lines (81 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//TODO! Disable missing XML comments.
#pragma warning disable CS1591
using CSharpToJavaScript.Utils;
using System;
namespace CSharpToJavaScript.APIs.JS.Ecma;
//https://262.ecma-international.org/14.0/#sec-error-objects
[To(ToAttribute.Default)]
public class Error : ErrorPrototype
{
[To(ToAttribute.FirstCharToLowerCase)]
public static ErrorPrototype Prototype { get; } = new();
[To(ToAttribute.Default)]
public Error(string message, object? options = null)
{
}
}
[To(ToAttribute.FirstCharToLowerCase)]
public class ErrorPrototype : FunctionPrototype
{
public string Message { get; set; } = string.Empty;
public string Name { get; set; } = "Error";
public ErrorPrototype() { }
public new string ToString()
{
throw new NotImplementedException();
}
}
[To(ToAttribute.Default)]
public class EvalError : Error
{
[To(ToAttribute.Default)]
public EvalError(string message) : base(message) { }
}
[To(ToAttribute.Default)]
public class RangeError : Error
{
[To(ToAttribute.Default)]
public RangeError(string message) : base(message) { }
}
[To(ToAttribute.Default)]
public class ReferenceError : Error
{
[To(ToAttribute.Default)]
public ReferenceError(string message) : base(message) { }
}
[To(ToAttribute.Default)]
public class SyntaxError : Error
{
[To(ToAttribute.Default)]
public SyntaxError(string message) : base(message) { }
}
[To(ToAttribute.Default)]
public class TypeError : Error
{
[To(ToAttribute.Default)]
public TypeError(string message) : base(message) { }
}
[To(ToAttribute.Default)]
public class URIError : Error
{
[To(ToAttribute.Default)]
public URIError(string message) : base(message) { }
}
//TODO?
//https://262.ecma-international.org/14.0/#sec-nativeerror-object-structure
[To(ToAttribute.Default)]
public class AggregateError : AggregateErrorPrototype
{
[To(ToAttribute.FirstCharToLowerCase)]
public static AggregateErrorPrototype Prototype { get; } = new();
[To(ToAttribute.Default)]
public AggregateError(object[] errors, string message, object? options = null)
{
}
}
public class AggregateErrorPrototype
{
public string Message { get; set; } = string.Empty;
public string Name { get; set; } = "AggregateError";
public AggregateErrorPrototype() { }
}