modality-kit 0.5.2 → 0.5.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/index.js +7 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -166,11 +166,11 @@ class ModalityLogger {
|
|
|
166
166
|
const error = result.error;
|
|
167
167
|
if (error instanceof Error) {
|
|
168
168
|
delete result.error;
|
|
169
|
-
const { message, stack } = error;
|
|
169
|
+
const { message, stack, ...restError } = error;
|
|
170
170
|
if (stack) {
|
|
171
|
-
if (Object.keys(
|
|
171
|
+
if (Object.keys(restError).length) {
|
|
172
172
|
console.error(`
|
|
173
|
-
`, prefix,
|
|
173
|
+
`, prefix, restError, `
|
|
174
174
|
`, stack, `
|
|
175
175
|
`);
|
|
176
176
|
} else {
|
|
@@ -245,13 +245,12 @@ function withErrorHandling(fn, operation) {
|
|
|
245
245
|
} catch (error) {
|
|
246
246
|
if (error instanceof ErrorCode) {
|
|
247
247
|
logger.error(`${operation || "Task operation"} failed: ${error.code}`, {
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
code: error.code,
|
|
249
|
+
cause: error.cause,
|
|
250
|
+
stack: error.stack
|
|
250
251
|
});
|
|
251
252
|
} else if (error instanceof Error) {
|
|
252
|
-
logger.error(`${operation || "Error"} failed`,
|
|
253
|
-
message: error.message
|
|
254
|
-
});
|
|
253
|
+
logger.error(`${operation || "Error"} failed`, error);
|
|
255
254
|
} else {
|
|
256
255
|
logger.error(`${operation || "Exception"} unexpected error:`, error);
|
|
257
256
|
}
|
package/package.json
CHANGED