We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 344180f commit add96f1Copy full SHA for add96f1
1 file changed
packages/utils/src/lib/errors.ts
@@ -36,14 +36,15 @@ export function stringifyError(
36
* This helps to keep the stacktrace intact and enables better debugging.
37
* @param error - The error to extend
38
* @param message - The new message to add to the error
39
+ * @param appendOriginalMessage - Whether to add the original error message after new message
40
* @returns A new error with the extended message and the original as cause
41
*/
42
export function extendError(
43
error: unknown,
44
message: string,
- { appendMessage = false } = {},
45
+ { appendOriginalMessage = false } = {},
46
) {
- const errorMessage = appendMessage
47
+ const errorMessage = appendOriginalMessage
48
? `${message}\n${stringifyError(error)}`
49
: message;
50
return new Error(errorMessage, { cause: error });
0 commit comments