silgi 0.25.2 → 0.25.3
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.
- package/dist/cli/index.mjs +1 -1
- package/dist/runtime/internal/nitro.mjs +23 -11
- package/dist/types/index.d.mts +1 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { ErrorFactory, HttpStatus, parseURI, silgi, SilgiError, useSilgi } from
|
|
|
3
3
|
export async function addNitroApp(silgiCtx = useSilgi()) {
|
|
4
4
|
const nitro = silgiCtx.framework;
|
|
5
5
|
nitro.router.use("/srn/**", defineEventHandler(async (event) => {
|
|
6
|
+
let operation;
|
|
6
7
|
try {
|
|
7
8
|
const silgiConnect = silgi(event);
|
|
8
9
|
const query = getQuery(event);
|
|
@@ -13,7 +14,7 @@ export async function addNitroApp(silgiCtx = useSilgi()) {
|
|
|
13
14
|
} else {
|
|
14
15
|
newPath = `${event.path}?method=${event.method}`;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
operation = parseURI(newPath, silgiCtx.uris);
|
|
17
18
|
if (!operation) {
|
|
18
19
|
throw ErrorFactory.create({ message: "Invalid URI", httpStatus: HttpStatus.BAD_REQUEST });
|
|
19
20
|
}
|
|
@@ -28,22 +29,33 @@ export async function addNitroApp(silgiCtx = useSilgi()) {
|
|
|
28
29
|
if (data) {
|
|
29
30
|
return data;
|
|
30
31
|
}
|
|
31
|
-
} catch (
|
|
32
|
-
if (
|
|
33
|
-
throw
|
|
32
|
+
} catch (err) {
|
|
33
|
+
if (err instanceof H3Error) {
|
|
34
|
+
throw err;
|
|
34
35
|
}
|
|
35
|
-
if (SilgiError.isError(
|
|
36
|
+
if (SilgiError.isError(err)) {
|
|
36
37
|
throw createError({
|
|
37
|
-
statusCode:
|
|
38
|
-
message:
|
|
38
|
+
statusCode: err.httpStatus,
|
|
39
|
+
message: err.message,
|
|
39
40
|
data: {
|
|
40
|
-
code:
|
|
41
|
-
category:
|
|
42
|
-
severity:
|
|
43
|
-
context:
|
|
41
|
+
code: err.code,
|
|
42
|
+
category: err.category,
|
|
43
|
+
severity: err.severity,
|
|
44
|
+
context: err.context
|
|
44
45
|
}
|
|
45
46
|
});
|
|
46
47
|
}
|
|
48
|
+
await silgiCtx.callHook("execute:error", {
|
|
49
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
50
|
+
timestamp: Date.now(),
|
|
51
|
+
operation,
|
|
52
|
+
event
|
|
53
|
+
});
|
|
54
|
+
silgiCtx.captureError(SilgiError.from(err), {
|
|
55
|
+
event,
|
|
56
|
+
operation,
|
|
57
|
+
tags: ["execute"]
|
|
58
|
+
});
|
|
47
59
|
throw createError({
|
|
48
60
|
statusCode: 500,
|
|
49
61
|
message: "Internal Server Error"
|
package/dist/types/index.d.mts
CHANGED