Skip to content

Commit 3728364

Browse files
authored
fix(common): Export and deprecate error helpers (#901)
1 parent 73d28d1 commit 3728364

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/common/src/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export * from './workflow-handle';
2222
export * from './deprecated-time';
2323

2424
import * as encoding from './encoding';
25+
import * as helpers from './type-helpers';
2526

2627
/**
2728
* Encode a UTF-8 string into a Uint8Array
@@ -42,3 +43,23 @@ export function u8(s: string): Uint8Array {
4243
export function str(arr: Uint8Array): string {
4344
return encoding.decode(arr);
4445
}
46+
47+
/**
48+
* Get `error.message` (or `undefined` if not present)
49+
*
50+
* @hidden
51+
* @deprecated - meant for internal use only
52+
*/
53+
export function errorMessage(error: unknown): string | undefined {
54+
return helpers.errorMessage(error);
55+
}
56+
57+
/**
58+
* Get `error.code` (or `undefined` if not present)
59+
*
60+
* @hidden
61+
* @deprecated - meant for internal use only
62+
*/
63+
export function errorCode(error: unknown): string | undefined {
64+
return helpers.errorCode(error);
65+
}

0 commit comments

Comments
 (0)