effect-errors 1.7.28 → 1.7.30
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/cjs/capture-errors.js +18 -21
- package/cjs/capture-errors.js.map +1 -1
- package/cjs/index.js +20 -69
- package/cjs/index.js.map +1 -1
- package/cjs/logic/effects/fs/fs-error.js +4 -6
- package/cjs/logic/effects/fs/fs-error.js.map +1 -1
- package/cjs/logic/effects/fs/fs-extra.effects.js +20 -45
- package/cjs/logic/effects/fs/fs-extra.effects.js.map +1 -1
- package/cjs/logic/errors/capture-errors-from-cause.js +10 -13
- package/cjs/logic/errors/capture-errors-from-cause.js.map +1 -1
- package/cjs/logic/errors/extract-error-details.js +53 -57
- package/cjs/logic/errors/extract-error-details.js.map +1 -1
- package/cjs/logic/errors/parse-error.js +17 -19
- package/cjs/logic/errors/parse-error.js.map +1 -1
- package/cjs/logic/pretty-printing/format-failures-title.js +11 -14
- package/cjs/logic/pretty-printing/format-failures-title.js.map +1 -1
- package/cjs/logic/pretty-printing/format-span-attributes.js +38 -51
- package/cjs/logic/pretty-printing/format-span-attributes.js.map +1 -1
- package/cjs/logic/pretty-printing/maybe-print-node-stacktrace.js +13 -19
- package/cjs/logic/pretty-printing/maybe-print-node-stacktrace.js.map +1 -1
- package/cjs/logic/pretty-printing/maybe-print-span-attributes.js +18 -26
- package/cjs/logic/pretty-printing/maybe-print-span-attributes.js.map +1 -1
- package/cjs/logic/pretty-printing/maybe-warn-about-plain-strings.js +9 -14
- package/cjs/logic/pretty-printing/maybe-warn-about-plain-strings.js.map +1 -1
- package/cjs/logic/pretty-printing/print-effect-stacktrace.js +12 -19
- package/cjs/logic/pretty-printing/print-effect-stacktrace.js.map +1 -1
- package/cjs/logic/spans/get-span-attributes.js +16 -25
- package/cjs/logic/spans/get-span-attributes.js.map +1 -1
- package/cjs/logic/spans/get-span-duration.js +10 -15
- package/cjs/logic/spans/get-span-duration.js.map +1 -1
- package/cjs/logic/spans/maybe-add-error-to-spans-stack.js +13 -16
- package/cjs/logic/spans/maybe-add-error-to-spans-stack.js.map +1 -1
- package/cjs/logic/spans/spans-stack-trailing-char.js +6 -11
- package/cjs/logic/spans/spans-stack-trailing-char.js.map +1 -1
- package/cjs/logic/spans/split-spans-attributes-by-type.js +12 -15
- package/cjs/logic/spans/split-spans-attributes-by-type.js.map +1 -1
- package/cjs/logic/stack/filter-stack.js +14 -17
- package/cjs/logic/stack/filter-stack.js.map +1 -1
- package/cjs/logic/stack/stack-regex.js +4 -7
- package/cjs/logic/stack/stack-regex.js.map +1 -1
- package/cjs/logic/strip-cwd-path.js +3 -6
- package/cjs/logic/strip-cwd-path.js.map +1 -1
- package/cjs/logic/util/big-int-replacer.js +8 -11
- package/cjs/logic/util/big-int-replacer.js.map +1 -1
- package/cjs/package.json +1 -0
- package/cjs/pretty-print.js +34 -40
- package/cjs/pretty-print.js.map +1 -1
- package/cjs/runners/run-promise.js +11 -14
- package/cjs/runners/run-promise.js.map +1 -1
- package/cjs/runners/run-sync.js +10 -13
- package/cjs/runners/run-sync.js.map +1 -1
- package/cjs/source-maps/get-error-location-from-file-path.js +11 -18
- package/cjs/source-maps/get-error-location-from-file-path.js.map +1 -1
- package/cjs/source-maps/get-error-related-sources.js +22 -29
- package/cjs/source-maps/get-error-related-sources.js.map +1 -1
- package/cjs/source-maps/get-source-code.js +18 -22
- package/cjs/source-maps/get-source-code.js.map +1 -1
- package/cjs/source-maps/get-sources-from-map-file.js +42 -45
- package/cjs/source-maps/get-sources-from-map-file.js.map +1 -1
- package/cjs/source-maps/get-sources-from-span.js +36 -48
- package/cjs/source-maps/get-sources-from-span.js.map +1 -1
- package/cjs/source-maps/get-sources-from-stack.js +16 -19
- package/cjs/source-maps/get-sources-from-stack.js.map +1 -1
- package/cjs/source-maps/maybe-map-sourcemaps.js +24 -25
- package/cjs/source-maps/maybe-map-sourcemaps.js.map +1 -1
- package/cjs/source-maps/transform-raw-error.js +30 -48
- package/cjs/source-maps/transform-raw-error.js.map +1 -1
- package/cjs/types/pretty-error.type.js +13 -16
- package/cjs/types/pretty-error.type.js.map +1 -1
- package/cjs/types/pretty-print-options.type.js +5 -8
- package/cjs/types/pretty-print-options.type.js.map +1 -1
- package/dts/capture-errors.d.ts +0 -1
- package/dts/index.d.ts +0 -1
- package/dts/logic/effects/fs/fs-error.d.ts +0 -1
- package/dts/logic/effects/fs/fs-extra.effects.d.ts +0 -1
- package/dts/logic/errors/capture-errors-from-cause.d.ts +0 -1
- package/dts/logic/errors/extract-error-details.d.ts +0 -1
- package/dts/logic/errors/parse-error.d.ts +0 -1
- package/dts/logic/pretty-printing/format-failures-title.d.ts +0 -1
- package/dts/logic/pretty-printing/format-span-attributes.d.ts +0 -1
- package/dts/logic/pretty-printing/maybe-print-node-stacktrace.d.ts +0 -1
- package/dts/logic/pretty-printing/maybe-print-span-attributes.d.ts +0 -1
- package/dts/logic/pretty-printing/maybe-warn-about-plain-strings.d.ts +0 -1
- package/dts/logic/pretty-printing/print-effect-stacktrace.d.ts +0 -1
- package/dts/logic/spans/get-span-attributes.d.ts +0 -1
- package/dts/logic/spans/get-span-duration.d.ts +0 -1
- package/dts/logic/spans/maybe-add-error-to-spans-stack.d.ts +0 -1
- package/dts/logic/spans/spans-stack-trailing-char.d.ts +0 -1
- package/dts/logic/spans/split-spans-attributes-by-type.d.ts +0 -1
- package/dts/logic/stack/filter-stack.d.ts +0 -1
- package/dts/logic/stack/stack-regex.d.ts +0 -1
- package/dts/logic/strip-cwd-path.d.ts +0 -1
- package/dts/logic/util/big-int-replacer.d.ts +0 -1
- package/dts/pretty-print.d.ts +0 -1
- package/dts/runners/run-promise.d.ts +0 -1
- package/dts/runners/run-sync.d.ts +0 -1
- package/dts/source-maps/get-error-location-from-file-path.d.ts +0 -1
- package/dts/source-maps/get-error-related-sources.d.ts +0 -1
- package/dts/source-maps/get-source-code.d.ts +0 -1
- package/dts/source-maps/get-sources-from-map-file.d.ts +0 -1
- package/dts/source-maps/get-sources-from-span.d.ts +0 -1
- package/dts/source-maps/get-sources-from-stack.d.ts +0 -1
- package/dts/source-maps/maybe-map-sourcemaps.d.ts +0 -1
- package/dts/source-maps/transform-raw-error.d.ts +0 -1
- package/dts/types/pretty-error.type.d.ts +0 -1
- package/dts/types/pretty-print-options.type.d.ts +0 -1
- package/esm/capture-errors.js +12 -12
- package/esm/capture-errors.js.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/logic/effects/fs/fs-error.js +2 -1
- package/esm/logic/effects/fs/fs-error.js.map +1 -1
- package/esm/logic/effects/fs/fs-extra.effects.js +12 -32
- package/esm/logic/effects/fs/fs-extra.effects.js.map +1 -1
- package/esm/logic/errors/capture-errors-from-cause.js +7 -7
- package/esm/logic/errors/capture-errors-from-cause.js.map +1 -1
- package/esm/logic/errors/extract-error-details.js +50 -51
- package/esm/logic/errors/extract-error-details.js.map +1 -1
- package/esm/logic/errors/parse-error.js +13 -12
- package/esm/logic/errors/parse-error.js.map +1 -1
- package/esm/logic/pretty-printing/format-failures-title.js +6 -4
- package/esm/logic/pretty-printing/format-failures-title.js.map +1 -1
- package/esm/logic/pretty-printing/format-span-attributes.js +28 -36
- package/esm/logic/pretty-printing/format-span-attributes.js.map +1 -1
- package/esm/logic/pretty-printing/maybe-print-node-stacktrace.js +7 -8
- package/esm/logic/pretty-printing/maybe-print-node-stacktrace.js.map +1 -1
- package/esm/logic/pretty-printing/maybe-print-span-attributes.js +12 -15
- package/esm/logic/pretty-printing/maybe-print-span-attributes.js.map +1 -1
- package/esm/logic/pretty-printing/maybe-warn-about-plain-strings.js +4 -4
- package/esm/logic/pretty-printing/maybe-warn-about-plain-strings.js.map +1 -1
- package/esm/logic/pretty-printing/print-effect-stacktrace.js +6 -8
- package/esm/logic/pretty-printing/print-effect-stacktrace.js.map +1 -1
- package/esm/logic/spans/get-span-attributes.js +10 -14
- package/esm/logic/spans/get-span-attributes.js.map +1 -1
- package/esm/logic/spans/get-span-duration.js +5 -5
- package/esm/logic/spans/get-span-duration.js.map +1 -1
- package/esm/logic/spans/maybe-add-error-to-spans-stack.js +11 -11
- package/esm/logic/spans/maybe-add-error-to-spans-stack.js.map +1 -1
- package/esm/logic/spans/spans-stack-trailing-char.js +1 -1
- package/esm/logic/spans/spans-stack-trailing-char.js.map +1 -1
- package/esm/logic/spans/split-spans-attributes-by-type.js +11 -11
- package/esm/logic/spans/split-spans-attributes-by-type.js.map +1 -1
- package/esm/logic/stack/filter-stack.js +10 -10
- package/esm/logic/stack/filter-stack.js.map +1 -1
- package/esm/logic/stack/stack-regex.js.map +1 -1
- package/esm/logic/strip-cwd-path.js +2 -2
- package/esm/logic/strip-cwd-path.js.map +1 -1
- package/esm/logic/util/big-int-replacer.js +7 -7
- package/esm/logic/util/big-int-replacer.js.map +1 -1
- package/esm/package.json +1 -0
- package/esm/pretty-print.js +20 -21
- package/esm/pretty-print.js.map +1 -1
- package/esm/runners/run-promise.js +8 -8
- package/esm/runners/run-promise.js.map +1 -1
- package/esm/runners/run-sync.js +7 -7
- package/esm/runners/run-sync.js.map +1 -1
- package/esm/source-maps/get-error-location-from-file-path.js +9 -13
- package/esm/source-maps/get-error-location-from-file-path.js.map +1 -1
- package/esm/source-maps/get-error-related-sources.js +18 -22
- package/esm/source-maps/get-error-related-sources.js.map +1 -1
- package/esm/source-maps/get-source-code.js +15 -16
- package/esm/source-maps/get-source-code.js.map +1 -1
- package/esm/source-maps/get-sources-from-map-file.js +34 -32
- package/esm/source-maps/get-sources-from-map-file.js.map +1 -1
- package/esm/source-maps/get-sources-from-span.js +31 -40
- package/esm/source-maps/get-sources-from-span.js.map +1 -1
- package/esm/source-maps/get-sources-from-stack.js +11 -11
- package/esm/source-maps/get-sources-from-stack.js.map +1 -1
- package/esm/source-maps/maybe-map-sourcemaps.js +20 -18
- package/esm/source-maps/maybe-map-sourcemaps.js.map +1 -1
- package/esm/source-maps/transform-raw-error.js +23 -38
- package/esm/source-maps/transform-raw-error.js.map +1 -1
- package/esm/types/pretty-error.type.js +12 -12
- package/esm/types/pretty-error.type.js.map +1 -1
- package/esm/types/pretty-print-options.type.js +3 -3
- package/esm/types/pretty-print-options.type.js.map +1 -1
- package/package.json +11 -10
- package/dts/capture-errors.d.ts.map +0 -1
- package/dts/index.d.ts.map +0 -1
- package/dts/logic/effects/fs/fs-error.d.ts.map +0 -1
- package/dts/logic/effects/fs/fs-extra.effects.d.ts.map +0 -1
- package/dts/logic/errors/capture-errors-from-cause.d.ts.map +0 -1
- package/dts/logic/errors/extract-error-details.d.ts.map +0 -1
- package/dts/logic/errors/parse-error.d.ts.map +0 -1
- package/dts/logic/pretty-printing/format-failures-title.d.ts.map +0 -1
- package/dts/logic/pretty-printing/format-span-attributes.d.ts.map +0 -1
- package/dts/logic/pretty-printing/maybe-print-node-stacktrace.d.ts.map +0 -1
- package/dts/logic/pretty-printing/maybe-print-span-attributes.d.ts.map +0 -1
- package/dts/logic/pretty-printing/maybe-warn-about-plain-strings.d.ts.map +0 -1
- package/dts/logic/pretty-printing/print-effect-stacktrace.d.ts.map +0 -1
- package/dts/logic/spans/get-span-attributes.d.ts.map +0 -1
- package/dts/logic/spans/get-span-duration.d.ts.map +0 -1
- package/dts/logic/spans/maybe-add-error-to-spans-stack.d.ts.map +0 -1
- package/dts/logic/spans/spans-stack-trailing-char.d.ts.map +0 -1
- package/dts/logic/spans/split-spans-attributes-by-type.d.ts.map +0 -1
- package/dts/logic/stack/filter-stack.d.ts.map +0 -1
- package/dts/logic/stack/stack-regex.d.ts.map +0 -1
- package/dts/logic/strip-cwd-path.d.ts.map +0 -1
- package/dts/logic/util/big-int-replacer.d.ts.map +0 -1
- package/dts/pretty-print.d.ts.map +0 -1
- package/dts/runners/run-promise.d.ts.map +0 -1
- package/dts/runners/run-sync.d.ts.map +0 -1
- package/dts/source-maps/get-error-location-from-file-path.d.ts.map +0 -1
- package/dts/source-maps/get-error-related-sources.d.ts.map +0 -1
- package/dts/source-maps/get-source-code.d.ts.map +0 -1
- package/dts/source-maps/get-sources-from-map-file.d.ts.map +0 -1
- package/dts/source-maps/get-sources-from-span.d.ts.map +0 -1
- package/dts/source-maps/get-sources-from-stack.d.ts.map +0 -1
- package/dts/source-maps/maybe-map-sourcemaps.d.ts.map +0 -1
- package/dts/source-maps/transform-raw-error.d.ts.map +0 -1
- package/dts/types/pretty-error.type.d.ts.map +0 -1
- package/dts/types/pretty-print-options.type.d.ts.map +0 -1
- package/esm/tsconfig-prod.tsbuildinfo +0 -1
package/esm/capture-errors.js
CHANGED
|
@@ -3,20 +3,20 @@ import { isInterruptedOnly } from 'effect/Cause';
|
|
|
3
3
|
import { captureErrorsFrom } from './logic/errors/capture-errors-from-cause.js';
|
|
4
4
|
import { transformRawError } from './source-maps/transform-raw-error.js';
|
|
5
5
|
export const captureErrors = (cause, options = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
reverseSpans: true,
|
|
7
|
+
stripCwd: true,
|
|
8
8
|
}) => Effect.gen(function* () {
|
|
9
|
-
|
|
9
|
+
if (isInterruptedOnly(cause)) {
|
|
10
|
+
return {
|
|
11
|
+
interrupted: true,
|
|
12
|
+
errors: [],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const rawErrors = captureErrorsFrom(cause);
|
|
16
|
+
const errors = yield* Effect.forEach(rawErrors, transformRawError(options));
|
|
10
17
|
return {
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
interrupted: false,
|
|
19
|
+
errors,
|
|
13
20
|
};
|
|
14
|
-
}
|
|
15
|
-
const rawErrors = captureErrorsFrom(cause);
|
|
16
|
-
const errors = yield* Effect.forEach(rawErrors, transformRawError(options));
|
|
17
|
-
return {
|
|
18
|
-
interrupted: false,
|
|
19
|
-
errors
|
|
20
|
-
};
|
|
21
21
|
});
|
|
22
22
|
//# sourceMappingURL=capture-errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-errors.js","
|
|
1
|
+
{"version":3,"file":"capture-errors.js","sourceRoot":"","sources":["../../src/capture-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAc,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAGhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AA8BzE,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,KAAe,EACf,UAAgC;IAC9B,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,IAAI;CACf,EACuC,EAAE,CAC1C,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO;YACL,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,iBAAiB,CAAI,KAAK,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5E,OAAO;QACL,WAAW,EAAE,KAAK;QAClB,MAAM;KACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-error.js","
|
|
1
|
+
{"version":3,"file":"fs-error.js","sourceRoot":"","sources":["../../../../../src/logic/effects/fs/fs-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,OAAQ,SAAQ,WAAW,CAAC,UAAU,CAGjD;CAAG"}
|
|
@@ -1,36 +1,16 @@
|
|
|
1
1
|
import { Effect, pipe } from 'effect';
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
3
|
import { FsError } from './fs-error.js';
|
|
4
|
-
export const readFileEffect = path => pipe(Effect.tryPromise({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}), Effect.withSpan('
|
|
12
|
-
|
|
13
|
-
path
|
|
14
|
-
|
|
15
|
-
}));
|
|
16
|
-
export const existsEffect = path => pipe(Effect.tryPromise({
|
|
17
|
-
try: async () => await fs.exists(path),
|
|
18
|
-
catch: e => new FsError({
|
|
19
|
-
cause: e
|
|
20
|
-
})
|
|
21
|
-
}), Effect.withSpan('exists', {
|
|
22
|
-
attributes: {
|
|
23
|
-
path
|
|
24
|
-
}
|
|
25
|
-
}));
|
|
26
|
-
export const readJsonEffect = path => pipe(Effect.tryPromise({
|
|
27
|
-
try: async () => await fs.readJson(path),
|
|
28
|
-
catch: e => new FsError({
|
|
29
|
-
cause: e
|
|
30
|
-
})
|
|
31
|
-
}), Effect.withSpan('readJson', {
|
|
32
|
-
attributes: {
|
|
33
|
-
path
|
|
34
|
-
}
|
|
35
|
-
}));
|
|
4
|
+
export const readFileEffect = (path) => pipe(Effect.tryPromise({
|
|
5
|
+
try: async () => await fs.readFile(path, { encoding: 'utf8' }),
|
|
6
|
+
catch: (e) => new FsError({ cause: e }),
|
|
7
|
+
}), Effect.withSpan('readFile', { attributes: { path } }));
|
|
8
|
+
export const existsEffect = (path) => pipe(Effect.tryPromise({
|
|
9
|
+
try: async () => await fs.exists(path),
|
|
10
|
+
catch: (e) => new FsError({ cause: e }),
|
|
11
|
+
}), Effect.withSpan('exists', { attributes: { path } }));
|
|
12
|
+
export const readJsonEffect = (path) => pipe(Effect.tryPromise({
|
|
13
|
+
try: async () => await fs.readJson(path),
|
|
14
|
+
catch: (e) => new FsError({ cause: e }),
|
|
15
|
+
}), Effect.withSpan('readJson', { attributes: { path } }));
|
|
36
16
|
//# sourceMappingURL=fs-extra.effects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-extra.effects.js","
|
|
1
|
+
{"version":3,"file":"fs-extra.effects.js","sourceRoot":"","sources":["../../../../../src/logic/effects/fs/fs-extra.effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE,CAC7C,IAAI,CACF,MAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC9D,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;CACxC,CAAC,EACF,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CACtD,CAAC;AAEJ,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE,CAC3C,IAAI,CACF,MAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;CACxC,CAAC,EACF,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CACpD,CAAC;AAEJ,MAAM,CAAC,MAAM,cAAc,GAAG,CAAU,IAAY,EAAE,EAAE,CACtD,IAAI,CACF,MAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,MAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAsB;IAC9D,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;CACxC,CAAC,EACF,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CACtD,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { reduceWithContext } from 'effect/Cause';
|
|
2
2
|
import { parseError } from './parse-error.js';
|
|
3
|
-
export const captureErrorsFrom = cause => reduceWithContext(cause, undefined, {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
export const captureErrorsFrom = (cause) => reduceWithContext(cause, undefined, {
|
|
4
|
+
emptyCase: () => [],
|
|
5
|
+
dieCase: (_, unknownError) => [parseError(unknownError)],
|
|
6
|
+
failCase: (_, error) => [parseError(error)],
|
|
7
|
+
interruptCase: () => [],
|
|
8
|
+
parallelCase: (_, l, r) => [...l, ...r],
|
|
9
|
+
sequentialCase: (_, l, r) => [...l, ...r],
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=capture-errors-from-cause.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-errors-from-cause.js","
|
|
1
|
+
{"version":3,"file":"capture-errors-from-cause.js","sourceRoot":"","sources":["../../../../src/logic/errors/capture-errors-from-cause.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAI,KAAe,EAA0B,EAAE,CAC9E,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE;IAClC,SAAS,EAAE,GAA2B,EAAE,CAAC,EAAE;IAC3C,OAAO,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACxD,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3C,aAAa,EAAE,GAAG,EAAE,CAAC,EAAE;IACvB,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACvC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;CAC1C,CAAC,CAAC"}
|
|
@@ -1,56 +1,55 @@
|
|
|
1
1
|
import { isFunction } from 'effect/Function';
|
|
2
2
|
import { hasProperty } from 'effect/Predicate';
|
|
3
|
-
export const extractErrorDetails = error => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
// TaggedError with cause
|
|
11
|
-
if (error instanceof Error && hasProperty(error, 'cause') && hasProperty(error, '_tag')) {
|
|
12
|
-
return {
|
|
13
|
-
isPlainString: false,
|
|
14
|
-
type: error._tag,
|
|
15
|
-
message: error.cause
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
// TaggedError with error ctor
|
|
19
|
-
if (error instanceof Error && hasProperty(error, 'error')) {
|
|
20
|
-
return {
|
|
21
|
-
isPlainString: false,
|
|
22
|
-
type: error.name,
|
|
23
|
-
message: error.error
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
// Plain objects with tag attribute
|
|
27
|
-
if (hasProperty(error, '_tag') && hasProperty(error, 'message')) {
|
|
28
|
-
return {
|
|
29
|
-
isPlainString: false,
|
|
30
|
-
type: error._tag,
|
|
31
|
-
message: error.message
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
// Plain objects with toString impl
|
|
35
|
-
if (hasProperty(error, 'toString') && isFunction(error.toString) && error.toString !== Object.prototype.toString && error.toString !== Array.prototype.toString) {
|
|
36
|
-
const message = error.toString();
|
|
37
|
-
const maybeWithUnderlyingType = message.split(': ');
|
|
38
|
-
if (maybeWithUnderlyingType.length > 1) {
|
|
39
|
-
const [type, ...message] = maybeWithUnderlyingType;
|
|
40
|
-
return {
|
|
41
|
-
isPlainString: false,
|
|
42
|
-
type,
|
|
43
|
-
message
|
|
44
|
-
};
|
|
3
|
+
export const extractErrorDetails = (error) => {
|
|
4
|
+
if (typeof error === 'string') {
|
|
5
|
+
return {
|
|
6
|
+
isPlainString: true,
|
|
7
|
+
message: error,
|
|
8
|
+
};
|
|
45
9
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
10
|
+
// TaggedError with cause
|
|
11
|
+
if (error instanceof Error &&
|
|
12
|
+
hasProperty(error, 'cause') &&
|
|
13
|
+
hasProperty(error, '_tag')) {
|
|
14
|
+
return {
|
|
15
|
+
isPlainString: false,
|
|
16
|
+
type: error._tag,
|
|
17
|
+
message: error.cause,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
// TaggedError with error ctor
|
|
21
|
+
if (error instanceof Error && hasProperty(error, 'error')) {
|
|
22
|
+
return {
|
|
23
|
+
isPlainString: false,
|
|
24
|
+
type: error.name,
|
|
25
|
+
message: error.error,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Plain objects with tag attribute
|
|
29
|
+
if (hasProperty(error, '_tag') && hasProperty(error, 'message')) {
|
|
30
|
+
return {
|
|
31
|
+
isPlainString: false,
|
|
32
|
+
type: error._tag,
|
|
33
|
+
message: error.message,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// Plain objects with toString impl
|
|
37
|
+
if (hasProperty(error, 'toString') &&
|
|
38
|
+
isFunction(error.toString) &&
|
|
39
|
+
error.toString !== Object.prototype.toString &&
|
|
40
|
+
error.toString !== Array.prototype.toString) {
|
|
41
|
+
const message = error.toString();
|
|
42
|
+
const maybeWithUnderlyingType = message.split(': ');
|
|
43
|
+
if (maybeWithUnderlyingType.length > 1) {
|
|
44
|
+
const [type, ...message] = maybeWithUnderlyingType;
|
|
45
|
+
return {
|
|
46
|
+
isPlainString: false,
|
|
47
|
+
type,
|
|
48
|
+
message,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return { message, isPlainString: false };
|
|
52
|
+
}
|
|
53
|
+
return { message: `Error: ${JSON.stringify(error)}`, isPlainString: false };
|
|
55
54
|
};
|
|
56
55
|
//# sourceMappingURL=extract-error-details.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-error-details.js","
|
|
1
|
+
{"version":3,"file":"extract-error-details.js","sourceRoot":"","sources":["../../../../src/logic/errors/extract-error-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQ/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAAgB,EAAE;IAClE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAED,yBAAyB;IACzB,IACE,KAAK,YAAY,KAAK;QACtB,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC;QAC3B,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAC1B,CAAC;QACD,OAAO;YACL,aAAa,EAAE,KAAK;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,KAAK;SACrB,CAAC;IACJ,CAAC;IAED,8BAA8B;IAC9B,IAAI,KAAK,YAAY,KAAK,IAAI,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;QAC1D,OAAO;YACL,aAAa,EAAE,KAAK;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,KAAK;SACrB,CAAC;IACJ,CAAC;IAED,mCAAmC;IACnC,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;QAChE,OAAO;YACL,aAAa,EAAE,KAAK;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC;IACJ,CAAC;IAED,mCAAmC;IACnC,IACE,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC;QAC9B,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC1B,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,SAAS,CAAC,QAAQ;QAC5C,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,SAAS,CAAC,QAAQ,EAC3C,CAAC;QACD,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjC,MAAM,uBAAuB,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEpD,IAAI,uBAAuB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvC,MAAM,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,uBAAuB,CAAC;YAEnD,OAAO;gBACL,aAAa,EAAE,KAAK;gBACpB,IAAI;gBACJ,OAAO;aACR,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAC3C,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,UAAU,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAC9E,CAAC,CAAC"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { hasProperty } from 'effect/Predicate';
|
|
2
2
|
import { PrettyError } from '../../types/pretty-error.type.js';
|
|
3
3
|
import { extractErrorDetails } from './extract-error-details.js';
|
|
4
|
-
const spanSymbol =
|
|
5
|
-
export const parseError = error => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
const spanSymbol = Symbol.for('effect/SpanAnnotation');
|
|
5
|
+
export const parseError = (error) => {
|
|
6
|
+
const span = hasProperty(error, spanSymbol)
|
|
7
|
+
? error[spanSymbol]
|
|
8
|
+
: undefined;
|
|
9
|
+
const { message, type, isPlainString } = extractErrorDetails(error);
|
|
10
|
+
if (error instanceof Error) {
|
|
11
|
+
return new PrettyError(message, error.stack
|
|
12
|
+
?.split('\n')
|
|
13
|
+
.filter((el) => /at (.*)/.exec(el))
|
|
14
|
+
.join('\r\n'), span, false, type);
|
|
15
|
+
}
|
|
16
|
+
return new PrettyError(message, undefined, span, isPlainString, type);
|
|
16
17
|
};
|
|
17
18
|
//# sourceMappingURL=parse-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-error.js","
|
|
1
|
+
{"version":3,"file":"parse-error.js","sourceRoot":"","sources":["../../../../src/logic/errors/parse-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAe,EAAE;IACxD,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC;QACzC,CAAC,CAAE,KAAK,CAAC,UAAU,CAAU;QAC7B,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAEpE,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,WAAW,CACpB,OAAO,EACP,KAAK,CAAC,KAAK;YACT,EAAE,KAAK,CAAC,IAAI,CAAC;aACZ,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aAClC,IAAI,CAAC,MAAM,CAAC,EACf,IAAI,EACJ,KAAK,EACL,IAAI,CACL,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;AACxE,CAAC,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import color from 'picocolors';
|
|
2
2
|
export const formatFailuresTitle = (errorType, message, failuresLength, failureIndex) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const failuresCount = failuresLength > 1
|
|
4
|
+
? color.bgRed(color.white(` #${failureIndex + 1} -`))
|
|
5
|
+
: '';
|
|
6
|
+
const type = color.bgRed(color.white(` ${errorType ?? 'Unknown error'} `));
|
|
7
|
+
const formattedMessage = color.bold(color.white(` • ${message}`));
|
|
8
|
+
return `💥 ${failuresCount}${type}${formattedMessage}\r\n`;
|
|
7
9
|
};
|
|
8
10
|
//# sourceMappingURL=format-failures-title.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-failures-title.js","
|
|
1
|
+
{"version":3,"file":"format-failures-title.js","sourceRoot":"","sources":["../../../../src/logic/pretty-printing/format-failures-title.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,SAAkB,EAClB,OAAgB,EAChB,cAAsB,EACtB,YAAoB,EACpB,EAAE;IACF,MAAM,aAAa,GACjB,cAAc,GAAG,CAAC;QAChB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CACtB,KAAK,CAAC,KAAK,CAAC,IAAK,SAAgC,IAAI,eAAe,GAAG,CAAC,CACzE,CAAC;IACF,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,OAAiB,EAAE,CAAC,CAAC,CAAC;IAE5E,OAAO,MAAM,aAAa,GAAG,IAAI,GAAG,gBAAgB,MAAM,CAAC;AAC7D,CAAC,CAAC"}
|
|
@@ -4,41 +4,33 @@ import { getSpanAttributes } from '../spans/get-span-attributes.js';
|
|
|
4
4
|
import { getSpanDuration } from '../spans/get-span-duration.js';
|
|
5
5
|
import { spanStackTrailingChar } from '../spans/spans-stack-trailing-char.js';
|
|
6
6
|
import { stripCwdPath } from '../strip-cwd-path.js';
|
|
7
|
-
export const formatSpanAttributes = (span, {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
spans.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
}).reduce((prev, curr) => ({
|
|
37
|
-
message: prev.message + curr.message,
|
|
38
|
-
stack: [...prev.stack, ...curr.stack]
|
|
39
|
-
}), {
|
|
40
|
-
message: '',
|
|
41
|
-
stack: []
|
|
42
|
-
});
|
|
7
|
+
export const formatSpanAttributes = (span, { stripCwd, reverseSpans }) => {
|
|
8
|
+
let current = span;
|
|
9
|
+
const spans = [];
|
|
10
|
+
while (current !== undefined && current._tag === 'Span') {
|
|
11
|
+
spans.push(current);
|
|
12
|
+
current = Option.getOrUndefined(current.parent);
|
|
13
|
+
}
|
|
14
|
+
const orderedSpans = reverseSpans === true ? spans.toReversed() : spans;
|
|
15
|
+
return orderedSpans
|
|
16
|
+
.map(({ name, attributes, status }, index) => {
|
|
17
|
+
const isFirstEntry = index === 0;
|
|
18
|
+
const isLastEntry = index === spans.length - 1;
|
|
19
|
+
const filePath = ` at ${stripCwd !== undefined ? stripCwdPath(name) : name}`;
|
|
20
|
+
const { formattedAttributes, stack } = getSpanAttributes(attributes, isLastEntry);
|
|
21
|
+
const maybeCircle = isFirstEntry ? `\r\n${color.gray('◯')}` : '';
|
|
22
|
+
const message = color.white(`${maybeCircle}\r\n${spanStackTrailingChar(isLastEntry)}${color.gray('─')}${filePath}${getSpanDuration(status, isLastEntry)}${formattedAttributes}`);
|
|
23
|
+
return {
|
|
24
|
+
message,
|
|
25
|
+
stack,
|
|
26
|
+
};
|
|
27
|
+
})
|
|
28
|
+
.reduce((prev, curr) => ({
|
|
29
|
+
message: prev.message + curr.message,
|
|
30
|
+
stack: [...prev.stack, ...curr.stack],
|
|
31
|
+
}), {
|
|
32
|
+
message: '',
|
|
33
|
+
stack: [],
|
|
34
|
+
});
|
|
43
35
|
};
|
|
44
36
|
//# sourceMappingURL=format-span-attributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-span-attributes.js","
|
|
1
|
+
{"version":3,"file":"format-span-attributes.js","sourceRoot":"","sources":["../../../../src/logic/pretty-printing/format-span-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,MAAM,YAAY,CAAC;AAG/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAsB,EACtB,EAAE,QAAQ,EAAE,YAAY,EAAsB,EAC9C,EAAE;IACF,IAAI,OAAO,GAA+B,IAAI,CAAC;IAE/C,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,YAAY,GAAG,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAExE,OAAO,YAAY;SAChB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE;QAC3C,MAAM,YAAY,GAAG,KAAK,KAAK,CAAC,CAAC;QACjC,MAAM,WAAW,GAAG,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAE/C,MAAM,QAAQ,GAAG,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAE7E,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,GAAG,iBAAiB,CACtD,UAAU,EACV,WAAW,CACZ,CAAC;QAEF,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAEjE,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CACzB,GAAG,WAAW,OAAO,qBAAqB,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,mBAAmB,EAAE,CACpJ,CAAC;QAEF,OAAO;YACL,OAAO;YACP,KAAK;SACN,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CACL,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACf,OAAO,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO;QACpC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;KACtC,CAAC,EACF;QACE,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,EAAE;KACV,CACF,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import color from 'picocolors';
|
|
2
2
|
import { filterStack } from '../stack/filter-stack.js';
|
|
3
|
-
export const maybePrintNodeStacktrace = (d, span, stack, isPlainString, {
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
3
|
+
export const maybePrintNodeStacktrace = (d, span, stack, isPlainString, { stripCwd }) => {
|
|
4
|
+
if (stack !== undefined) {
|
|
5
|
+
d.push(`\r\n${span !== undefined ? '\r\n' : ''}🚨 Node Stacktrace\r\n${color.red(filterStack(stack, 'node', stripCwd === true))}`);
|
|
6
|
+
}
|
|
7
|
+
else if (!isPlainString) {
|
|
8
|
+
d.push(`\r\n\r\n${color.gray('ℹ️ Consider using a yieldable error such as Data.TaggedError and Schema.TaggedError to get a stacktrace.')}`);
|
|
9
|
+
}
|
|
11
10
|
};
|
|
12
11
|
//# sourceMappingURL=maybe-print-node-stacktrace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybe-print-node-stacktrace.js","
|
|
1
|
+
{"version":3,"file":"maybe-print-node-stacktrace.js","sourceRoot":"","sources":["../../../../src/logic/pretty-printing/maybe-print-node-stacktrace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,YAAY,CAAC;AAG/B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,CAAW,EACX,IAAsB,EACtB,KAAyB,EACzB,aAAsB,EACtB,EAAE,QAAQ,EAAsB,EAChC,EAAE;IACF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,CAAC,CAAC,IAAI,CACJ,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,yBAAyB,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC,CAAC,EAAE,CAC3H,CAAC;IACJ,CAAC;SAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC1B,CAAC,CAAC,IAAI,CACJ,WAAW,KAAK,CAAC,IAAI,CAAC,2GAA2G,CAAC,EAAE,CACrI,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import color from 'picocolors';
|
|
2
2
|
import { formatSpanAttributes } from './format-span-attributes.js';
|
|
3
|
-
export const maybePrintSpanAttributes = (d, span, isPlainString, {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!isPlainString) {
|
|
16
|
-
d.push(`\r\n${color.gray('ℹ️ Consider using spans to improve errors reporting.\r\n')}`);
|
|
17
|
-
}
|
|
3
|
+
export const maybePrintSpanAttributes = (d, span, isPlainString, { stripCwd, reverseSpans }) => {
|
|
4
|
+
if (span !== undefined) {
|
|
5
|
+
const spanData = formatSpanAttributes(span, {
|
|
6
|
+
stripCwd,
|
|
7
|
+
reverseSpans,
|
|
8
|
+
});
|
|
9
|
+
d.push(spanData.message);
|
|
10
|
+
return spanData.stack;
|
|
11
|
+
}
|
|
12
|
+
if (!isPlainString) {
|
|
13
|
+
d.push(`\r\n${color.gray('ℹ️ Consider using spans to improve errors reporting.\r\n')}`);
|
|
14
|
+
}
|
|
18
15
|
};
|
|
19
16
|
//# sourceMappingURL=maybe-print-span-attributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybe-print-span-attributes.js","
|
|
1
|
+
{"version":3,"file":"maybe-print-span-attributes.js","sourceRoot":"","sources":["../../../../src/logic/pretty-printing/maybe-print-span-attributes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,YAAY,CAAC;AAI/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,CAAW,EACX,IAAsB,EACtB,aAAsB,EACtB,EAAE,QAAQ,EAAE,YAAY,EAAsB,EAC9C,EAAE;IACF,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,EAAE;YAC1C,QAAQ;YACR,YAAY;SACb,CAAC,CAAC;QAEH,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,QAAQ,CAAC,KAAK,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,CAAC,CAAC,IAAI,CACJ,OAAO,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,EAAE,CACjF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import color from 'picocolors';
|
|
2
2
|
export const maybeWarnAboutPlainStrings = (d, isPlainString) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
if (!isPlainString) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
d.push(`\r\n${color.gray('ℹ️ You used a plain string to represent a failure in the error channel (E). You should consider using tagged objects (with a _tag field), or yieldable errors such as Data.TaggedError and Schema.TaggedError for better handling experience.')}`);
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=maybe-warn-about-plain-strings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybe-warn-about-plain-strings.js","
|
|
1
|
+
{"version":3,"file":"maybe-warn-about-plain-strings.js","sourceRoot":"","sources":["../../../../src/logic/pretty-printing/maybe-warn-about-plain-strings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,CAAW,EACX,aAAsB,EACtB,EAAE;IACF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO;IACT,CAAC;IAED,CAAC,CAAC,IAAI,CACJ,OAAO,KAAK,CAAC,IAAI,CAAC,gPAAgP,CAAC,EAAE,CACtQ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import color from 'picocolors';
|
|
2
2
|
import { filterStack } from '../stack/filter-stack.js';
|
|
3
|
-
export const printEffectStacktrace = (d, span, spanAttributesStack, {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const cleanedStack = `│ ${filterStack(spanAttributesStack.join('\r\n│ '), 'effect', stripCwd === true)}`;
|
|
10
|
-
d.push(`\r\n${span !== undefined ? '\r\n' : ''}🚨 Spans Stacktrace\r\n${color.red(cleanedStack)}`);
|
|
3
|
+
export const printEffectStacktrace = (d, span, spanAttributesStack, { stripCwd }) => {
|
|
4
|
+
if (spanAttributesStack === undefined || spanAttributesStack.length === 0) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const cleanedStack = `│ ${filterStack(spanAttributesStack.join('\r\n│ '), 'effect', stripCwd === true)}`;
|
|
8
|
+
d.push(`\r\n${span !== undefined ? '\r\n' : ''}🚨 Spans Stacktrace\r\n${color.red(cleanedStack)}`);
|
|
11
9
|
};
|
|
12
10
|
//# sourceMappingURL=print-effect-stacktrace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-effect-stacktrace.js","
|
|
1
|
+
{"version":3,"file":"print-effect-stacktrace.js","sourceRoot":"","sources":["../../../../src/logic/pretty-printing/print-effect-stacktrace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,YAAY,CAAC;AAG/B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,CAAW,EACX,IAAsB,EACtB,mBAAyC,EACzC,EAAE,QAAQ,EAAsB,EAChC,EAAE;IACF,IAAI,mBAAmB,KAAK,SAAS,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,WAAW,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC;IAEzG,CAAC,CAAC,IAAI,CACJ,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,0BAA0B,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAC3F,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import color from 'picocolors';
|
|
2
2
|
import { splitSpansAttributesByTypes } from './split-spans-attributes-by-type.js';
|
|
3
|
-
const maybePrintPipe = isLastEntry => isLastEntry ? ' ' : color.gray('│');
|
|
3
|
+
const maybePrintPipe = (isLastEntry) => isLastEntry ? ' ' : color.gray('│');
|
|
4
4
|
export const getSpanAttributes = (allAttributes, isLastEntry) => {
|
|
5
|
-
|
|
5
|
+
if (allAttributes.size === 0) {
|
|
6
|
+
return { formattedAttributes: '', stack: [] };
|
|
7
|
+
}
|
|
8
|
+
const { attributes, stacktrace } = splitSpansAttributesByTypes(allAttributes);
|
|
9
|
+
const formattedAttributes = Array.from(attributes)
|
|
10
|
+
.map(([key, value]) => `${maybePrintPipe(isLastEntry)} ${color.blue(key)}${color.gray(':')} ${value}`)
|
|
11
|
+
.join('\r\n');
|
|
6
12
|
return {
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
formattedAttributes: `${formattedAttributes.length > 0 ? '\r\n' : ''}${formattedAttributes}`,
|
|
14
|
+
stack: stacktrace,
|
|
9
15
|
};
|
|
10
|
-
}
|
|
11
|
-
const {
|
|
12
|
-
attributes,
|
|
13
|
-
stacktrace
|
|
14
|
-
} = splitSpansAttributesByTypes(allAttributes);
|
|
15
|
-
const formattedAttributes = Array.from(attributes).map(([key, value]) => `${maybePrintPipe(isLastEntry)} ${color.blue(key)}${color.gray(':')} ${value}`).join('\r\n');
|
|
16
|
-
return {
|
|
17
|
-
formattedAttributes: `${formattedAttributes.length > 0 ? '\r\n' : ''}${formattedAttributes}`,
|
|
18
|
-
stack: stacktrace
|
|
19
|
-
};
|
|
20
16
|
};
|
|
21
17
|
//# sourceMappingURL=get-span-attributes.js.map
|