@xmobitea/gn-server 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -30,8 +30,16 @@ interface FunctionRequest {
|
|
|
30
30
|
log: (log: any) => void,
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export enum ExecuteResponseStatus {
|
|
34
|
+
Ok = 1,
|
|
35
|
+
Exception = 2,
|
|
36
|
+
FunctionNameNotFound = 3,
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
33
41
|
interface FunctionResponse {
|
|
34
|
-
status:
|
|
42
|
+
status: ExecuteResponseStatus,
|
|
35
43
|
result: any,
|
|
36
44
|
errorMessage: any,
|
|
37
45
|
}
|
|
@@ -90,14 +98,14 @@ async function ___handleFunction(request: FunctionRequest): Promise<FunctionResp
|
|
|
90
98
|
|
|
91
99
|
if (handler == null) {
|
|
92
100
|
return {
|
|
93
|
-
status:
|
|
101
|
+
status: ExecuteResponseStatus.FunctionNameNotFound,
|
|
94
102
|
result: null,
|
|
95
103
|
errorMessage: null,
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
|
|
99
107
|
let answer: FunctionResponse = {
|
|
100
|
-
status:
|
|
108
|
+
status: ExecuteResponseStatus.Ok,
|
|
101
109
|
errorMessage: null,
|
|
102
110
|
result: null,
|
|
103
111
|
}
|
|
@@ -106,7 +114,7 @@ async function ___handleFunction(request: FunctionRequest): Promise<FunctionResp
|
|
|
106
114
|
answer.result = await handler(request);
|
|
107
115
|
}
|
|
108
116
|
catch (err: any) {
|
|
109
|
-
answer.status =
|
|
117
|
+
answer.status = ExecuteResponseStatus.Exception;
|
|
110
118
|
answer.errorMessage = err.message;
|
|
111
119
|
}
|
|
112
120
|
|