go-go-try 7.2.1 → 7.4.0

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.
@@ -0,0 +1,20 @@
1
+ import { taggedError } from './tagged-error.js'
2
+
3
+ /**
4
+ * Default system error class for errors that aren't already wrapped in a tagged error class.
5
+ *
6
+ * @example
7
+ * // By default, goTryRaw wraps unknown errors in UnknownError
8
+ * const [err, result] = goTryRaw(() => mightThrow())
9
+ * if (err) {
10
+ * console.log(err._tag) // 'UnknownError'
11
+ * }
12
+ *
13
+ * @example
14
+ * // Use a custom system error class
15
+ * const SystemError = taggedError('SystemError')
16
+ * const [err, result] = goTryRaw(() => mightThrow(), {
17
+ * systemErrorClass: SystemError
18
+ * })
19
+ */
20
+ export const UnknownError = taggedError('UnknownError')