errore 0.7.0 → 0.7.1
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/README.md +2 -2
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -161,10 +161,10 @@ if (errore.isError(result)) {
|
|
|
161
161
|
import * as errore from 'errore'
|
|
162
162
|
|
|
163
163
|
// Sync - wraps exceptions in UnhandledError
|
|
164
|
-
const parsed = errore.
|
|
164
|
+
const parsed = errore.try(() => JSON.parse(input))
|
|
165
165
|
|
|
166
166
|
// Sync - with custom error type
|
|
167
|
-
const parsed = errore.
|
|
167
|
+
const parsed = errore.try({
|
|
168
168
|
try: () => JSON.parse(input),
|
|
169
169
|
catch: e => new ParseError({ cause: e })
|
|
170
170
|
})
|
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
partition: () => partition,
|
|
37
37
|
tap: () => tap,
|
|
38
38
|
tapAsync: () => tapAsync,
|
|
39
|
+
try: () => tryFn,
|
|
39
40
|
tryAsync: () => tryAsync,
|
|
40
41
|
tryFn: () => tryFn,
|
|
41
42
|
unwrap: () => unwrap,
|
|
@@ -254,6 +255,7 @@ function flatten(value) {
|
|
|
254
255
|
partition,
|
|
255
256
|
tap,
|
|
256
257
|
tapAsync,
|
|
258
|
+
try: null,
|
|
257
259
|
tryAsync,
|
|
258
260
|
tryFn,
|
|
259
261
|
unwrap,
|
package/dist/index.d.cts
CHANGED
|
@@ -321,4 +321,4 @@ declare function partition<V>(values: V[]): [Exclude<V, Error>[], Extract<V, Err
|
|
|
321
321
|
*/
|
|
322
322
|
declare function flatten<V>(value: V): V;
|
|
323
323
|
|
|
324
|
-
export { type EnsureNotError, type Errore, type InferError, type InferValue, TaggedError, type TaggedErrorClass, type TaggedErrorInstance, UnhandledError, andThen, andThenAsync, flatten, isError, isOk, isTaggedError, map, mapError, match, matchError, matchErrorPartial, partition, tap, tapAsync, tryAsync, tryFn, unwrap, unwrapOr };
|
|
324
|
+
export { type EnsureNotError, type Errore, type InferError, type InferValue, TaggedError, type TaggedErrorClass, type TaggedErrorInstance, UnhandledError, andThen, andThenAsync, flatten, isError, isOk, isTaggedError, map, mapError, match, matchError, matchErrorPartial, partition, tap, tapAsync, tryFn as try, tryAsync, tryFn, unwrap, unwrapOr };
|
package/dist/index.d.ts
CHANGED
|
@@ -321,4 +321,4 @@ declare function partition<V>(values: V[]): [Exclude<V, Error>[], Extract<V, Err
|
|
|
321
321
|
*/
|
|
322
322
|
declare function flatten<V>(value: V): V;
|
|
323
323
|
|
|
324
|
-
export { type EnsureNotError, type Errore, type InferError, type InferValue, TaggedError, type TaggedErrorClass, type TaggedErrorInstance, UnhandledError, andThen, andThenAsync, flatten, isError, isOk, isTaggedError, map, mapError, match, matchError, matchErrorPartial, partition, tap, tapAsync, tryAsync, tryFn, unwrap, unwrapOr };
|
|
324
|
+
export { type EnsureNotError, type Errore, type InferError, type InferValue, TaggedError, type TaggedErrorClass, type TaggedErrorInstance, UnhandledError, andThen, andThenAsync, flatten, isError, isOk, isTaggedError, map, mapError, match, matchError, matchErrorPartial, partition, tap, tapAsync, tryFn as try, tryAsync, tryFn, unwrap, unwrapOr };
|
package/dist/index.js
CHANGED