aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util/src/errors.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util/src/errors.ts')
-rw-r--r--packages/taler-util/src/errors.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/taler-util/src/errors.ts b/packages/taler-util/src/errors.ts
index 4dea7e1b6..9378d25e8 100644
--- a/packages/taler-util/src/errors.ts
+++ b/packages/taler-util/src/errors.ts
@@ -278,6 +278,10 @@ export class TalerError<T = any> extends Error {
}
}
+export function safeStringifyException(e: any): string {
+ return JSON.stringify(getErrorDetailFromException(e), undefined, 2);
+}
+
/**
* Convert an exception (or anything that was thrown) into
* a TalerErrorDetail object.