@h-ai/ui 1.0.0-beta.21 → 1.0.0-beta.22
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/toast.svelte.js +13 -4
- package/package.json +2 -2
package/dist/toast.svelte.js
CHANGED
|
@@ -324,11 +324,20 @@ export function errorMessage(error, fallback = '') {
|
|
|
324
324
|
? error
|
|
325
325
|
: '';
|
|
326
326
|
const embeddedTraceId = /\(traceId: ([\w.:-]{1,128})\)$/.exec(receivedMessage)?.[1];
|
|
327
|
-
const
|
|
328
|
-
|
|
327
|
+
const reportedTraceId = known?.traceId && /^[\w.:-]{1,128}$/.test(known.traceId)
|
|
328
|
+
? known.traceId
|
|
329
|
+
: embeddedTraceId;
|
|
330
|
+
const traceId = reportedTraceId ?? core.context.get().traceId ?? core.context.get().requestId ?? core.id.uuid();
|
|
331
|
+
const safe = known && core.error.toPublic(known, traceId);
|
|
332
|
+
const status = safe?.httpStatus;
|
|
333
|
+
const logContext = { traceId, errorCode: safe?.code, status };
|
|
334
|
+
if (reportedTraceId || (status !== undefined && status >= 400 && status < 500))
|
|
335
|
+
core.logger.debug('User operation failed', logContext);
|
|
336
|
+
else
|
|
337
|
+
core.logger.error('User operation failed', { ...logContext, error });
|
|
329
338
|
let message = fallback || core.i18n.coreM('core_errorInternal');
|
|
330
|
-
if (
|
|
331
|
-
message =
|
|
339
|
+
if (safe)
|
|
340
|
+
message = safe.message;
|
|
332
341
|
else if (typeof error === 'string')
|
|
333
342
|
message = receivedMessage;
|
|
334
343
|
return core.error.formatMessage({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-ai/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.22",
|
|
5
5
|
"description": "Hai Framework UI component library for Svelte 5 Runes.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"svelte": "./dist/index.js",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"svelte": "^5.57.3"
|
|
130
130
|
},
|
|
131
131
|
"dependencies": {
|
|
132
|
-
"@h-ai/core": "1.0.0-beta.
|
|
132
|
+
"@h-ai/core": "1.0.0-beta.22",
|
|
133
133
|
"@internationalized/date": "^3.12.4",
|
|
134
134
|
"@rrweb/replay": "^2.2.1",
|
|
135
135
|
"@shikijs/langs": "^4.6.0",
|