This repository has been archived by the owner on May 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errorModel.asp
136 lines (106 loc) · 3.91 KB
/
errorModel.asp
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<%
' AUTO-GENERATED FILE - DO NOT MODIFY
' Generated from /Users/michael/gocode/etc/babeltemplates/error.babel
' Babel's Error Format
' Copyright (C) 2015 The Babel Authors
' *** Structures ***
' Error defines a single error message and code that might be localized
' and displayed to a caller.
class BabelError
sub Class_Initialize
' Fields from Error
Params = Array()
end sub
sub Class_Terminate
' Fields from Error
Params = Empty
end sub
' --- Members ---
' The service-specific error code
public Code ' string
' The text of the error in US-English
public Message ' string
' The list of parameters to the error message. This could be used by
' localization systems to generate messages based on the error code.
public Params ' list<string>
' Called by Babel protocol to write this object
public sub Write(s_, j_)
dim i_ : i_ = 0
call s_.Write(j_, "string", "Code", Code, "", i_)
call s_.Write(j_, "string", "Message", Message, "", i_)
call s_.Write(j_, "list<string>", "Params", Params, "string,", i_)
end sub
' Called by Babel protocol to read this object
public sub Read(s_, j_)
Code = s_.Read(j_, "string", "Code", Code, "")
Message = s_.Read(j_, "string", "Message", Message, "")
Params = s_.Read(j_, "list<string>", "Params", Params, "string,")
end sub
' Convert this object to a JSON string
public function ToJSON()
ToJSON = BabelToJson(empty, empty, me)
end function
' Convert this object to an XML document
public function ToXML()
set ToXML = BabelToXml(empty, "Error", me)
end function
end class
' ServiceError defines the error response generated by Babel for service failures
class BabelServiceError
sub Class_Initialize
' Fields from ServiceError
Tags = Array()
Errors = Array()
set Context = CreateObject("Scripting.Dictionary")
set Inner = Nothing
end sub
sub Class_Terminate
' Fields from ServiceError
Tags = Empty
Errors = Empty
set Context = Nothing
set Inner = Nothing
end sub
' --- Members ---
' Time of the error
public Time ' datetime
' Tags to categorize the error
public Tags ' list<string>
' A list of errors that occurred
public Errors ' list<Error>
' Context is a map of additional error details and context
public Context ' map<string,map<string,string>>
' Details contains optional detailed error information, such as error messages
' or a stack trace specific to the given server environment
public Details ' string
' Inner points to a service error propagated from another tier that is using Babel
public Inner ' ServiceError
' Called by Babel protocol to write this object
public sub Write(s_, j_)
dim i_ : i_ = 0
call s_.Write(j_, "datetime", "Time", Time, "", i_)
call s_.Write(j_, "list<string>", "Tags", Tags, "string,", i_)
call s_.Write(j_, "list<BabelError>", "Errors", Errors, "Error,", i_)
call s_.Write(j_, "map<string,map<string,string>>", "Context", Context, "string,map,string,string,", i_)
call s_.Write(j_, "string", "Details", Details, "", i_)
call s_.Write(j_, "BabelServiceError", "Inner", Inner, "", i_)
end sub
' Called by Babel protocol to read this object
public sub Read(s_, j_)
Time = s_.Read(j_, "datetime", "Time", Time, "")
Tags = s_.Read(j_, "list<string>", "Tags", Tags, "string,")
Errors = s_.Read(j_, "list<BabelError>", "Errors", Errors, "Error,")
set Context = s_.Read(j_, "map<string,map<string,string>>", "Context", Context, "string,map,string,string,")
Details = s_.Read(j_, "string", "Details", Details, "")
set Inner = s_.Read(j_, "BabelServiceError", "Inner", Inner, "")
end sub
' Convert this object to a JSON string
public function ToJSON()
ToJSON = BabelToJson(empty, empty, me)
end function
' Convert this object to an XML document
public function ToXML()
set ToXML = BabelToXml(empty, "ServiceError", me)
end function
end class
%>