effect-errors 1.7.46 → 1.8.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 +67 -5
- package/cjs/index.js +1 -0
- package/cjs/index.js.map +1 -1
- package/cjs/logic/logger/index.js +12 -0
- package/cjs/logic/logger/index.js.map +1 -0
- package/cjs/logic/pretty-printing/captured-errors/index.js +20 -0
- package/cjs/logic/pretty-printing/captured-errors/index.js.map +1 -0
- package/cjs/logic/pretty-printing/captured-errors/maybe-advise-spans-usage.js +18 -0
- package/cjs/logic/pretty-printing/captured-errors/maybe-advise-spans-usage.js.map +1 -0
- package/cjs/logic/pretty-printing/captured-errors/maybe-print-node-stacktrace.js +34 -0
- package/cjs/logic/pretty-printing/captured-errors/maybe-print-node-stacktrace.js.map +1 -0
- package/cjs/logic/pretty-printing/captured-errors/maybe-print-spans-timeline.js +30 -0
- package/cjs/logic/pretty-printing/captured-errors/maybe-print-spans-timeline.js.map +1 -0
- package/cjs/logic/pretty-printing/captured-errors/print-effect-stacktrace.js +27 -0
- package/cjs/logic/pretty-printing/captured-errors/print-effect-stacktrace.js.map +1 -0
- package/cjs/logic/pretty-printing/common/constants/interrupted-message.js +5 -0
- package/cjs/logic/pretty-printing/common/constants/interrupted-message.js.map +1 -0
- package/cjs/logic/pretty-printing/common/constants/missing-spans-warning.js +9 -0
- package/cjs/logic/pretty-printing/common/constants/missing-spans-warning.js.map +1 -0
- package/cjs/logic/pretty-printing/{format-failures-title.js → common/format-error-title.js} +5 -5
- package/cjs/logic/pretty-printing/common/format-error-title.js.map +1 -0
- package/cjs/logic/pretty-printing/common/format-span-attributes.js +18 -0
- package/cjs/logic/pretty-printing/common/format-span-attributes.js.map +1 -0
- package/cjs/logic/pretty-printing/common/format-span-duration.js +10 -0
- package/cjs/logic/pretty-printing/common/format-span-duration.js.map +1 -0
- package/cjs/logic/pretty-printing/common/format-title.js +17 -0
- package/cjs/logic/pretty-printing/common/format-title.js.map +1 -0
- package/cjs/logic/pretty-printing/common/index.js +23 -0
- package/cjs/logic/pretty-printing/common/index.js.map +1 -0
- package/cjs/logic/pretty-printing/common/maybe-warn-about-plain-strings.js +18 -0
- package/cjs/logic/pretty-printing/common/maybe-warn-about-plain-strings.js.map +1 -0
- package/cjs/logic/pretty-printing/common/spans-stack-trailing-char.js.map +1 -0
- package/cjs/logic/pretty-printing/failures/index.js +20 -0
- package/cjs/logic/pretty-printing/failures/index.js.map +1 -0
- package/cjs/logic/pretty-printing/failures/maybe-print-node-stacktrace.js +32 -0
- package/cjs/logic/pretty-printing/failures/maybe-print-node-stacktrace.js.map +1 -0
- package/cjs/logic/pretty-printing/{print-effect-stacktrace.js → failures/print-effect-stacktrace.js} +10 -4
- package/cjs/logic/pretty-printing/failures/print-effect-stacktrace.js.map +1 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/extract-spans.js +15 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/extract-spans.js.map +1 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/format/get-span-attributes.js +18 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/format/get-span-attributes.js.map +1 -0
- package/cjs/logic/{spans → pretty-printing/failures/spans-timeline/format}/get-span-duration.js +2 -5
- package/cjs/logic/pretty-printing/failures/spans-timeline/format/get-span-duration.js.map +1 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/format/index.js +19 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/format/index.js.map +1 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/format-spans-at-timeline.js +34 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/format-spans-at-timeline.js.map +1 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/maybe-print-spans-timeline.js +23 -0
- package/cjs/logic/pretty-printing/failures/spans-timeline/maybe-print-spans-timeline.js.map +1 -0
- package/cjs/logic/pretty-printing/format-captured-error.js +26 -0
- package/cjs/logic/pretty-printing/format-captured-error.js.map +1 -0
- package/cjs/logic/pretty-printing/format-failure.js +24 -0
- package/cjs/logic/pretty-printing/format-failure.js.map +1 -0
- package/cjs/logic/pretty-printing/index.js +21 -0
- package/cjs/logic/pretty-printing/index.js.map +1 -0
- package/cjs/pretty-print-from-captured-errors.js +15 -0
- package/cjs/pretty-print-from-captured-errors.js.map +1 -0
- package/cjs/pretty-print.js +5 -26
- package/cjs/pretty-print.js.map +1 -1
- package/cjs/source-maps/get-error-related-sources.js +3 -2
- package/cjs/source-maps/get-error-related-sources.js.map +1 -1
- package/cjs/source-maps/get-sources-from-map-file.js +10 -2
- package/cjs/source-maps/get-sources-from-map-file.js.map +1 -1
- package/cjs/source-maps/get-sources-from-span.js +1 -1
- package/cjs/source-maps/get-sources-from-span.js.map +1 -1
- package/cjs/source-maps/get-sources-from-stack.js +1 -1
- package/cjs/source-maps/get-sources-from-stack.js.map +1 -1
- package/cjs/source-maps/maybe-map-sourcemaps.js +2 -2
- package/cjs/source-maps/maybe-map-sourcemaps.js.map +1 -1
- package/cjs/types/pretty-print-options.type.js +1 -0
- package/cjs/types/pretty-print-options.type.js.map +1 -1
- package/dts/index.d.ts +1 -0
- package/dts/logic/logger/index.d.ts +10 -0
- package/dts/logic/pretty-printing/captured-errors/index.d.ts +3 -0
- package/dts/logic/pretty-printing/captured-errors/maybe-advise-spans-usage.d.ts +2 -0
- package/dts/logic/pretty-printing/captured-errors/maybe-print-node-stacktrace.d.ts +2 -0
- package/dts/logic/pretty-printing/captured-errors/maybe-print-spans-timeline.d.ts +2 -0
- package/dts/logic/pretty-printing/captured-errors/print-effect-stacktrace.d.ts +2 -0
- package/dts/logic/pretty-printing/common/constants/interrupted-message.d.ts +1 -0
- package/dts/logic/pretty-printing/common/constants/missing-spans-warning.d.ts +1 -0
- package/dts/logic/pretty-printing/common/format-error-title.d.ts +1 -0
- package/dts/logic/pretty-printing/common/format-span-attributes.d.ts +1 -0
- package/dts/logic/pretty-printing/common/format-span-duration.d.ts +1 -0
- package/dts/logic/pretty-printing/common/format-title.d.ts +1 -0
- package/dts/logic/pretty-printing/common/index.d.ts +6 -0
- package/dts/logic/pretty-printing/common/maybe-warn-about-plain-strings.d.ts +1 -0
- package/dts/logic/pretty-printing/failures/index.d.ts +3 -0
- package/dts/logic/pretty-printing/failures/maybe-print-node-stacktrace.d.ts +2 -0
- package/dts/logic/pretty-printing/failures/print-effect-stacktrace.d.ts +2 -0
- package/dts/logic/pretty-printing/failures/spans-timeline/extract-spans.d.ts +2 -0
- package/dts/logic/{spans → pretty-printing/failures/spans-timeline/format}/get-span-attributes.d.ts +1 -1
- package/dts/logic/pretty-printing/failures/spans-timeline/format/index.d.ts +2 -0
- package/dts/logic/pretty-printing/failures/spans-timeline/format-spans-at-timeline.d.ts +8 -0
- package/dts/logic/pretty-printing/failures/spans-timeline/maybe-print-spans-timeline.d.ts +8 -0
- package/dts/logic/pretty-printing/format-captured-error.d.ts +3 -0
- package/dts/logic/pretty-printing/format-failure.d.ts +3 -0
- package/dts/logic/pretty-printing/index.d.ts +4 -0
- package/dts/pretty-print-from-captured-errors.d.ts +3 -0
- package/dts/source-maps/get-error-related-sources.d.ts +1 -1
- package/dts/source-maps/get-sources-from-map-file.d.ts +3 -1
- package/dts/source-maps/maybe-map-sourcemaps.d.ts +1 -1
- package/dts/source-maps/transform-raw-error.d.ts +2 -0
- package/dts/types/pretty-print-options.type.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/logic/logger/index.js +8 -0
- package/esm/logic/logger/index.js.map +1 -0
- package/esm/logic/pretty-printing/captured-errors/index.js +4 -0
- package/esm/logic/pretty-printing/captured-errors/index.js.map +1 -0
- package/esm/logic/pretty-printing/captured-errors/maybe-advise-spans-usage.js +11 -0
- package/esm/logic/pretty-printing/captured-errors/maybe-advise-spans-usage.js.map +1 -0
- package/esm/logic/pretty-printing/captured-errors/maybe-print-node-stacktrace.js +27 -0
- package/esm/logic/pretty-printing/captured-errors/maybe-print-node-stacktrace.js.map +1 -0
- package/esm/logic/pretty-printing/captured-errors/maybe-print-spans-timeline.js +23 -0
- package/esm/logic/pretty-printing/captured-errors/maybe-print-spans-timeline.js.map +1 -0
- package/esm/logic/pretty-printing/captured-errors/print-effect-stacktrace.js +20 -0
- package/esm/logic/pretty-printing/captured-errors/print-effect-stacktrace.js.map +1 -0
- package/esm/logic/pretty-printing/common/constants/interrupted-message.js +2 -0
- package/esm/logic/pretty-printing/common/constants/interrupted-message.js.map +1 -0
- package/esm/logic/pretty-printing/common/constants/missing-spans-warning.js +3 -0
- package/esm/logic/pretty-printing/common/constants/missing-spans-warning.js.map +1 -0
- package/esm/logic/pretty-printing/{format-failures-title.js → common/format-error-title.js} +3 -3
- package/esm/logic/pretty-printing/common/format-error-title.js.map +1 -0
- package/esm/logic/pretty-printing/common/format-span-attributes.js +11 -0
- package/esm/logic/pretty-printing/common/format-span-attributes.js.map +1 -0
- package/esm/logic/pretty-printing/common/format-span-duration.js +3 -0
- package/esm/logic/pretty-printing/common/format-span-duration.js.map +1 -0
- package/esm/logic/pretty-printing/common/format-title.js +10 -0
- package/esm/logic/pretty-printing/common/format-title.js.map +1 -0
- package/esm/logic/pretty-printing/common/index.js +7 -0
- package/esm/logic/pretty-printing/common/index.js.map +1 -0
- package/esm/logic/pretty-printing/common/maybe-warn-about-plain-strings.js +11 -0
- package/esm/logic/pretty-printing/common/maybe-warn-about-plain-strings.js.map +1 -0
- package/esm/logic/pretty-printing/common/spans-stack-trailing-char.js.map +1 -0
- package/esm/logic/pretty-printing/failures/index.js +4 -0
- package/esm/logic/pretty-printing/failures/index.js.map +1 -0
- package/esm/logic/pretty-printing/failures/maybe-print-node-stacktrace.js +25 -0
- package/esm/logic/pretty-printing/failures/maybe-print-node-stacktrace.js.map +1 -0
- package/esm/logic/pretty-printing/failures/print-effect-stacktrace.js +16 -0
- package/esm/logic/pretty-printing/failures/print-effect-stacktrace.js.map +1 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/extract-spans.js +11 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/extract-spans.js.map +1 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/format/get-span-attributes.js +14 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/format/get-span-attributes.js.map +1 -0
- package/esm/logic/{spans → pretty-printing/failures/spans-timeline/format}/get-span-duration.js +2 -2
- package/esm/logic/pretty-printing/failures/spans-timeline/format/get-span-duration.js.map +1 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/format/index.js +3 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/format/index.js.map +1 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/format-spans-at-timeline.js +27 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/format-spans-at-timeline.js.map +1 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/maybe-print-spans-timeline.js +19 -0
- package/esm/logic/pretty-printing/failures/spans-timeline/maybe-print-spans-timeline.js.map +1 -0
- package/esm/logic/pretty-printing/format-captured-error.js +22 -0
- package/esm/logic/pretty-printing/format-captured-error.js.map +1 -0
- package/esm/logic/pretty-printing/format-failure.js +20 -0
- package/esm/logic/pretty-printing/format-failure.js.map +1 -0
- package/esm/logic/pretty-printing/index.js +5 -0
- package/esm/logic/pretty-printing/index.js.map +1 -0
- package/esm/pretty-print-from-captured-errors.js +11 -0
- package/esm/pretty-print-from-captured-errors.js.map +1 -0
- package/esm/pretty-print.js +5 -23
- package/esm/pretty-print.js.map +1 -1
- package/esm/source-maps/get-error-related-sources.js +3 -2
- package/esm/source-maps/get-error-related-sources.js.map +1 -1
- package/esm/source-maps/get-sources-from-map-file.js +10 -2
- package/esm/source-maps/get-sources-from-map-file.js.map +1 -1
- package/esm/source-maps/get-sources-from-span.js +1 -1
- package/esm/source-maps/get-sources-from-span.js.map +1 -1
- package/esm/source-maps/get-sources-from-stack.js +1 -1
- package/esm/source-maps/get-sources-from-stack.js.map +1 -1
- package/esm/source-maps/maybe-map-sourcemaps.js +2 -2
- package/esm/source-maps/maybe-map-sourcemaps.js.map +1 -1
- package/esm/types/pretty-print-options.type.js +1 -0
- package/esm/types/pretty-print-options.type.js.map +1 -1
- package/package.json +1 -1
- package/cjs/logic/pretty-printing/format-failures-title.js.map +0 -1
- package/cjs/logic/pretty-printing/format-span-attributes.js +0 -43
- package/cjs/logic/pretty-printing/format-span-attributes.js.map +0 -1
- package/cjs/logic/pretty-printing/maybe-print-node-stacktrace.js +0 -18
- package/cjs/logic/pretty-printing/maybe-print-node-stacktrace.js.map +0 -1
- package/cjs/logic/pretty-printing/maybe-print-span-attributes.js +0 -23
- package/cjs/logic/pretty-printing/maybe-print-span-attributes.js.map +0 -1
- package/cjs/logic/pretty-printing/maybe-warn-about-plain-strings.js +0 -15
- package/cjs/logic/pretty-printing/maybe-warn-about-plain-strings.js.map +0 -1
- package/cjs/logic/pretty-printing/print-effect-stacktrace.js.map +0 -1
- package/cjs/logic/spans/get-span-attributes.js +0 -24
- package/cjs/logic/spans/get-span-attributes.js.map +0 -1
- package/cjs/logic/spans/get-span-duration.js.map +0 -1
- package/cjs/logic/spans/spans-stack-trailing-char.js.map +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 -6
- package/dts/logic/pretty-printing/maybe-print-node-stacktrace.d.ts +0 -3
- package/dts/logic/pretty-printing/maybe-print-span-attributes.d.ts +0 -3
- 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 -3
- package/esm/logic/pretty-printing/format-failures-title.js.map +0 -1
- package/esm/logic/pretty-printing/format-span-attributes.js +0 -36
- package/esm/logic/pretty-printing/format-span-attributes.js.map +0 -1
- package/esm/logic/pretty-printing/maybe-print-node-stacktrace.js +0 -11
- package/esm/logic/pretty-printing/maybe-print-node-stacktrace.js.map +0 -1
- package/esm/logic/pretty-printing/maybe-print-span-attributes.js +0 -16
- package/esm/logic/pretty-printing/maybe-print-span-attributes.js.map +0 -1
- package/esm/logic/pretty-printing/maybe-warn-about-plain-strings.js +0 -8
- package/esm/logic/pretty-printing/maybe-warn-about-plain-strings.js.map +0 -1
- package/esm/logic/pretty-printing/print-effect-stacktrace.js +0 -10
- package/esm/logic/pretty-printing/print-effect-stacktrace.js.map +0 -1
- package/esm/logic/spans/get-span-attributes.js +0 -17
- package/esm/logic/spans/get-span-attributes.js.map +0 -1
- package/esm/logic/spans/get-span-duration.js.map +0 -1
- package/esm/logic/spans/spans-stack-trailing-char.js.map +0 -1
- /package/cjs/logic/{spans → pretty-printing/common}/spans-stack-trailing-char.js +0 -0
- /package/dts/logic/{spans → pretty-printing/common}/spans-stack-trailing-char.d.ts +0 -0
- /package/dts/logic/{spans → pretty-printing/failures/spans-timeline/format}/get-span-duration.d.ts +0 -0
- /package/esm/logic/{spans → pretty-printing/common}/spans-stack-trailing-char.js +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# effect-errors
|
|
2
2
|
|
|
3
3
|
[](https://github.dev/jpb06/effect-errors)
|
|
4
|
+

|
|
5
|
+

|
|
4
6
|

|
|
5
7
|

|
|
6
8
|
[](https://sonarcloud.io/summary/new_code?id=jpb06_effect-errors)
|
|
@@ -14,7 +16,6 @@
|
|
|
14
16
|
[](https://sonarcloud.io/summary/new_code?id=jpb06_effect-errors)
|
|
15
17
|
[](https://sonarcloud.io/summary/new_code?id=jpb06_effect-errors)
|
|
16
18
|
[](https://sonarcloud.io/dashboard?id=jpb06_effect-errors)
|
|
17
|
-

|
|
18
19
|
|
|
19
20
|
Some sort of POC to improve the way [Effect](https://effect.website/) reports errors in a dev env 🤔
|
|
20
21
|
|
|
@@ -82,6 +83,65 @@ const prettyPrint: <E>(cause: Cause<E>, options?: PrettyPrintOptions) => string
|
|
|
82
83
|
|
|
83
84
|
> default: `true` (entry point first)
|
|
84
85
|
|
|
86
|
+
#### `hideStackTrace` - Whether node stacktrace should be displayed
|
|
87
|
+
|
|
88
|
+
> default: `true`
|
|
89
|
+
|
|
90
|
+
## ⚡ Pretty printing from captured errors
|
|
91
|
+
|
|
92
|
+
You can also use the function `prettyPrintFromCapturedErrors` to display errors from captured errors:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { NodeFileSystem } from '@effect/platform-node';
|
|
96
|
+
import { Effect, pipe } from 'effect';
|
|
97
|
+
import { TaggedError } from 'effect/Data';
|
|
98
|
+
|
|
99
|
+
import { captureErrors, prettyPrintFromCapturedErrors } from 'effect-errors';
|
|
100
|
+
|
|
101
|
+
export class MyCustomError extends TaggedError('MyCustomError')<{
|
|
102
|
+
cause?: unknown;
|
|
103
|
+
message?: string;
|
|
104
|
+
}> {}
|
|
105
|
+
|
|
106
|
+
const task = pipe(
|
|
107
|
+
Effect.fail(
|
|
108
|
+
new MyCustomError({
|
|
109
|
+
cause: 'Well this sucks',
|
|
110
|
+
}),
|
|
111
|
+
),
|
|
112
|
+
Effect.withSpan('task', {
|
|
113
|
+
attributes: { isCool: true },
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const program = pipe(
|
|
118
|
+
task,
|
|
119
|
+
Effect.sandbox,
|
|
120
|
+
Effect.catchAll((e) =>
|
|
121
|
+
Effect.gen(function* () {
|
|
122
|
+
const errors = yield* captureErrors(e);
|
|
123
|
+
const message = prettyPrintFromCapturedErrors(errors, {
|
|
124
|
+
stripCwd: true,
|
|
125
|
+
hideStackTrace: true,
|
|
126
|
+
reverseSpans: true,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
console.error(message);
|
|
130
|
+
|
|
131
|
+
// Do something with the captured errors ...
|
|
132
|
+
}),
|
|
133
|
+
),
|
|
134
|
+
Effect.provide(NodeFileSystem.layer),
|
|
135
|
+
Effect.withSpan('program', { attributes: { name: 'cool' } }),
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
Effect.runPromise(program);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The result would look like so:
|
|
142
|
+
|
|
143
|
+

|
|
144
|
+
|
|
85
145
|
## ⚡ How should I raise errors?
|
|
86
146
|
|
|
87
147
|
The best way is to use either `SchemaError` or `TaggedError`.
|
|
@@ -189,6 +249,7 @@ import { NodeFileSystem } from '@effect/platform-node';
|
|
|
189
249
|
await Effect.runPromise(
|
|
190
250
|
pipe(
|
|
191
251
|
effect,
|
|
252
|
+
Effect.sandbox,
|
|
192
253
|
Effect.catchAll((e) =>
|
|
193
254
|
Effect.gen(function* () {
|
|
194
255
|
const errors = yield* captureErrors(e);
|
|
@@ -231,6 +292,7 @@ Capturing errors from the [`from-promise` bundle](./src/tests/bundle/from-promis
|
|
|
231
292
|
],
|
|
232
293
|
"sources": [
|
|
233
294
|
{
|
|
295
|
+
"name": "FetchError",
|
|
234
296
|
"runPath": "/Users/jpb06/repos/perso/effect-errors/src/tests/bundle/from-promise.js:37:352",
|
|
235
297
|
"sourcesPath": "/Users/jpb06/repos/perso/effect-errors/src/examples/from-promise.ts:30:13",
|
|
236
298
|
"source": [
|
|
@@ -266,6 +328,7 @@ Capturing errors from the [`from-promise` bundle](./src/tests/bundle/from-promis
|
|
|
266
328
|
]
|
|
267
329
|
},
|
|
268
330
|
{
|
|
331
|
+
"name": "fetchTask",
|
|
269
332
|
"runPath": "/Users/jpb06/repos/perso/effect-errors/src/tests/bundle/from-promise.js:37:213",
|
|
270
333
|
"sourcesPath": "/Users/jpb06/repos/perso/effect-errors/src/examples/from-promise.ts:25:10",
|
|
271
334
|
"source": [
|
|
@@ -283,7 +346,7 @@ Capturing errors from the [`from-promise` bundle](./src/tests/bundle/from-promis
|
|
|
283
346
|
},
|
|
284
347
|
{
|
|
285
348
|
"line": 25,
|
|
286
|
-
"code": " Effect.withSpan('
|
|
349
|
+
"code": " Effect.withSpan('fetch-user', { attributes: { userId } })(",
|
|
287
350
|
"column": 10
|
|
288
351
|
},
|
|
289
352
|
{
|
|
@@ -301,6 +364,7 @@ Capturing errors from the [`from-promise` bundle](./src/tests/bundle/from-promis
|
|
|
301
364
|
]
|
|
302
365
|
},
|
|
303
366
|
{
|
|
367
|
+
"name": "fromPromiseTask",
|
|
304
368
|
"runPath": "/Users/jpb06/repos/perso/effect-errors/src/tests/bundle/from-promise.js:37:490",
|
|
305
369
|
"sourcesPath": "/Users/jpb06/repos/perso/effect-errors/src/examples/from-promise.ts:44:39",
|
|
306
370
|
"source": [
|
|
@@ -318,7 +382,7 @@ Capturing errors from the [`from-promise` bundle](./src/tests/bundle/from-promis
|
|
|
318
382
|
},
|
|
319
383
|
{
|
|
320
384
|
"line": 44,
|
|
321
|
-
"code": "export const fromPromiseTask = Effect.withSpan('
|
|
385
|
+
"code": "export const fromPromiseTask = Effect.withSpan('from-promise-task')(",
|
|
322
386
|
"column": 39
|
|
323
387
|
},
|
|
324
388
|
{
|
|
@@ -358,8 +422,6 @@ Capturing errors from the [`from-promise` bundle](./src/tests/bundle/from-promis
|
|
|
358
422
|
|
|
359
423
|
If no map file is found, a `location` array will be returned instead of `sources`:
|
|
360
424
|
|
|
361
|
-
|
|
362
|
-
|
|
363
425
|
```json
|
|
364
426
|
{
|
|
365
427
|
"interrupted": false,
|
package/cjs/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./pretty-print.js"), exports);
|
|
18
|
+
__exportStar(require("./pretty-print-from-captured-errors.js"), exports);
|
|
18
19
|
__exportStar(require("./runners/run-promise.js"), exports);
|
|
19
20
|
__exportStar(require("./runners/run-sync.js"), exports);
|
|
20
21
|
__exportStar(require("./types/pretty-print-options.type.js"), exports);
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,wDAAsC;AACtC,uEAAqD;AACrD,sDAAoC;AACpC,mEAAiD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,yEAAuD;AACvD,2DAAyC;AACzC,wDAAsC;AACtC,uEAAqD;AACrD,sDAAoC;AACpC,mEAAiD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoggerConsoleLive = exports.Logger = void 0;
|
|
4
|
+
const effect_1 = require("effect");
|
|
5
|
+
class Logger extends effect_1.Context.Tag('Logger')() {
|
|
6
|
+
}
|
|
7
|
+
exports.Logger = Logger;
|
|
8
|
+
exports.LoggerConsoleLive = effect_1.Layer.succeed(Logger, {
|
|
9
|
+
info: (message, ...optionalParams) => (0, effect_1.pipe)(effect_1.Effect.succeed(console.info(message, ...optionalParams)), effect_1.Effect.withSpan('logger-console/info')),
|
|
10
|
+
error: (message, ...optionalParams) => (0, effect_1.pipe)(effect_1.Effect.succeed(console.error(message, ...optionalParams)), effect_1.Effect.withSpan('logger-console/error')),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/logic/logger/index.ts"],"names":[],"mappings":";;;AAAA,mCAAsD;AAEtD,MAAa,MAAO,SAAQ,gBAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAY9C;CAAG;AAZN,wBAYM;AAGO,QAAA,iBAAiB,GAAG,cAAK,CAAC,OAAO,CAAC,MAAM,EAAE;IACrD,IAAI,EAAE,CAAC,OAAiB,EAAE,GAAG,cAAyB,EAAE,EAAE,CACxD,IAAA,aAAI,EACF,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC,EACxD,eAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CACvC;IACH,KAAK,EAAE,CAAC,OAAiB,EAAE,GAAG,cAAyB,EAAE,EAAE,CACzD,IAAA,aAAI,EACF,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC,EACzD,eAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CACxC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./print-effect-stacktrace.js"), exports);
|
|
18
|
+
__exportStar(require("./maybe-print-node-stacktrace.js"), exports);
|
|
19
|
+
__exportStar(require("./maybe-print-spans-timeline.js"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/captured-errors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,mEAAiD;AACjD,kEAAgD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.maybeAdviseSpansUsage = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const maybeAdviseSpansUsage = (spans) => {
|
|
9
|
+
if (spans === undefined || spans.length === 0) {
|
|
10
|
+
return [
|
|
11
|
+
'',
|
|
12
|
+
picocolors_1.default.gray('ℹ️ Consider using spans to improve errors reporting.'),
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
return [];
|
|
16
|
+
};
|
|
17
|
+
exports.maybeAdviseSpansUsage = maybeAdviseSpansUsage;
|
|
18
|
+
//# sourceMappingURL=maybe-advise-spans-usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maybe-advise-spans-usage.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/captured-errors/maybe-advise-spans-usage.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAIxB,MAAM,qBAAqB,GAAG,CACnC,KAA8B,EACpB,EAAE;IACZ,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO;YACL,EAAE;YACF,oBAAK,CAAC,IAAI,CAAC,uDAAuD,CAAC;SACpE,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAXW,QAAA,qBAAqB,yBAWhC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.maybePrintNodeStacktrace = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const strip_cwd_path_js_1 = require("../../strip-cwd-path.js");
|
|
9
|
+
const maybePrintNodeStacktrace = (stack, isPlainString, { stripCwd, hideStackTrace }) => {
|
|
10
|
+
if (hideStackTrace) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const stackHasNodes = stack !== undefined && stack.length > 0;
|
|
14
|
+
if (stackHasNodes) {
|
|
15
|
+
const nodes = stack
|
|
16
|
+
.map((el) => `│ ${stripCwd ? (0, strip_cwd_path_js_1.stripCwdPath)(el) : el}`)
|
|
17
|
+
.join('\r\n');
|
|
18
|
+
return [
|
|
19
|
+
'',
|
|
20
|
+
`${picocolors_1.default.bold(picocolors_1.default.red('◯'))} ${picocolors_1.default.redBright(picocolors_1.default.underline('Node Stacktrace 🚨'))}`,
|
|
21
|
+
picocolors_1.default.red(nodes),
|
|
22
|
+
picocolors_1.default.red('┴'),
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
if (!isPlainString) {
|
|
26
|
+
return [
|
|
27
|
+
'',
|
|
28
|
+
picocolors_1.default.gray('ℹ️ Consider using a yieldable error such as Data.TaggedError and Schema.TaggedError to get a stacktrace.'),
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
32
|
+
};
|
|
33
|
+
exports.maybePrintNodeStacktrace = maybePrintNodeStacktrace;
|
|
34
|
+
//# sourceMappingURL=maybe-print-node-stacktrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maybe-print-node-stacktrace.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/captured-errors/maybe-print-node-stacktrace.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAG/B,+DAAuD;AAEhD,MAAM,wBAAwB,GAAG,CACtC,KAA2B,EAC3B,aAAsB,EACtB,EAAE,QAAQ,EAAE,cAAc,EAAsB,EACtC,EAAE;IACZ,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,aAAa,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9D,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,KAAK,GAAG,KAAK;aAChB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,gCAAY,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;aACpD,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhB,OAAO;YACL,EAAE;YACF,GAAG,oBAAK,CAAC,IAAI,CAAC,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,oBAAK,CAAC,SAAS,CAAC,oBAAK,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,EAAE;YACzF,oBAAK,CAAC,GAAG,CAAC,KAAK,CAAC;YAChB,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC;SACf,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO;YACL,EAAE;YACF,oBAAK,CAAC,IAAI,CACR,2GAA2G,CAC5G;SACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAjCW,QAAA,wBAAwB,4BAiCnC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.maybePrintSpansTimeline = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const strip_cwd_path_js_1 = require("../../strip-cwd-path.js");
|
|
9
|
+
const index_js_1 = require("../common/index.js");
|
|
10
|
+
const maybePrintSpansTimeline = (spans, isPlainString, { stripCwd, reverseSpans }) => {
|
|
11
|
+
if (spans === undefined) {
|
|
12
|
+
return isPlainString === false ? ['', index_js_1.missingSpansWarning, ''] : [];
|
|
13
|
+
}
|
|
14
|
+
const orderedSpans = reverseSpans === true ? spans.toReversed() : spans;
|
|
15
|
+
return orderedSpans.reduce((output, { name, durationInMilliseconds, attributes }, index) => {
|
|
16
|
+
const isFirstEntry = index === 0;
|
|
17
|
+
const isLastEntry = index === spans.length - 1;
|
|
18
|
+
const maybeCircle = isFirstEntry ? `\r\n${picocolors_1.default.gray('◯')}\r\n` : '';
|
|
19
|
+
const trailing = (0, index_js_1.spanStackTrailingChar)(isLastEntry);
|
|
20
|
+
const filePath = ` ${stripCwd !== undefined ? picocolors_1.default.underline(picocolors_1.default.bold((0, strip_cwd_path_js_1.stripCwdPath)(name))) : picocolors_1.default.underline(name)}`;
|
|
21
|
+
const duration = durationInMilliseconds !== undefined
|
|
22
|
+
? picocolors_1.default.gray((0, index_js_1.formatSpanDuration)(durationInMilliseconds, isLastEntry))
|
|
23
|
+
: '';
|
|
24
|
+
const formattedAttributes = (0, index_js_1.formatSpanAttributes)(attributes, isLastEntry);
|
|
25
|
+
const timelineEntry = picocolors_1.default.white(`${maybeCircle}${trailing}${picocolors_1.default.gray('─')}${filePath}${duration}${formattedAttributes}`);
|
|
26
|
+
return [...output, timelineEntry];
|
|
27
|
+
}, []);
|
|
28
|
+
};
|
|
29
|
+
exports.maybePrintSpansTimeline = maybePrintSpansTimeline;
|
|
30
|
+
//# sourceMappingURL=maybe-print-spans-timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maybe-print-spans-timeline.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/captured-errors/maybe-print-spans-timeline.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAG/B,+DAAuD;AACvD,iDAK4B;AAErB,MAAM,uBAAuB,GAAG,CACrC,KAA8B,EAC9B,aAAsB,EACtB,EAAE,QAAQ,EAAE,YAAY,EAAsB,EACpC,EAAE;IACZ,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,8BAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,CAAC;IAED,MAAM,YAAY,GAAG,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACxE,OAAO,YAAY,CAAC,MAAM,CACxB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE;QAC9D,MAAM,YAAY,GAAG,KAAK,KAAK,CAAC,CAAC;QACjC,MAAM,WAAW,GAAG,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAE/C,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,OAAO,oBAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,MAAM,QAAQ,GAAG,IAAA,gCAAqB,EAAC,WAAW,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,oBAAK,CAAC,SAAS,CAAC,oBAAK,CAAC,IAAI,CAAC,IAAA,gCAAY,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxH,MAAM,QAAQ,GACZ,sBAAsB,KAAK,SAAS;YAClC,CAAC,CAAC,oBAAK,CAAC,IAAI,CAAC,IAAA,6BAAkB,EAAC,sBAAsB,EAAE,WAAW,CAAC,CAAC;YACrE,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,mBAAmB,GAAG,IAAA,+BAAoB,EAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAE1E,MAAM,aAAa,GAAG,oBAAK,CAAC,KAAK,CAC/B,GAAG,WAAW,GAAG,QAAQ,GAAG,oBAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,GAAG,QAAQ,GAAG,mBAAmB,EAAE,CAC1F,CAAC;QAEF,OAAO,CAAC,GAAG,MAAM,EAAE,aAAa,CAAC,CAAC;IACpC,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC,CAAC;AAhCW,QAAA,uBAAuB,2BAgClC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.printEffectStacktrace = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const strip_cwd_path_js_1 = require("../../strip-cwd-path.js");
|
|
9
|
+
const printEffectStacktrace = (sources, spans, { stripCwd }) => {
|
|
10
|
+
if (spans === undefined ||
|
|
11
|
+
spans.length === 0 ||
|
|
12
|
+
sources === undefined ||
|
|
13
|
+
sources.length === 0) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const paths = sources.map(({ name, runPath, sourcesPath }) => {
|
|
17
|
+
const path = sourcesPath ?? runPath;
|
|
18
|
+
return { path: stripCwd ? (0, strip_cwd_path_js_1.stripCwdPath)(path) : path, name };
|
|
19
|
+
});
|
|
20
|
+
return [
|
|
21
|
+
`${picocolors_1.default.bold(picocolors_1.default.red('◯'))} ${picocolors_1.default.red('Sources')} 🕵️`,
|
|
22
|
+
...paths.map(({ path, name }) => picocolors_1.default.red(`│ at ${name.length === 0 ? 'module code' : picocolors_1.default.underline(name)} (${path})`)),
|
|
23
|
+
picocolors_1.default.red('┴'),
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
exports.printEffectStacktrace = printEffectStacktrace;
|
|
27
|
+
//# sourceMappingURL=print-effect-stacktrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"print-effect-stacktrace.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/captured-errors/print-effect-stacktrace.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAO/B,+DAAuD;AAEhD,MAAM,qBAAqB,GAAG,CACnC,OAAwD,EACxD,KAA8B,EAC9B,EAAE,QAAQ,EAAsB,EAChC,EAAE;IACF,IACE,KAAK,KAAK,SAAS;QACnB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,OAAO,KAAK,SAAS;QACrB,OAAO,CAAC,MAAM,KAAK,CAAC,EACpB,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAC3D,MAAM,IAAI,GAAG,WAAW,IAAI,OAAO,CAAC;QACpC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAA,gCAAY,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,oBAAK,CAAC,IAAI,CAAC,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,oBAAK,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM;QAC3D,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAC9B,oBAAK,CAAC,GAAG,CACP,QAAQ,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,oBAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,CAC9E,CACF;QACD,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC;KACf,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,qBAAqB,yBA4BhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interrupted-message.js","sourceRoot":"","sources":["../../../../../../src/logic/pretty-printing/common/constants/interrupted-message.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.missingSpansWarning = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
exports.missingSpansWarning = `\r\n${picocolors_1.default.gray('ℹ️ Consider using spans to improve errors reporting.')}`;
|
|
9
|
+
//# sourceMappingURL=missing-spans-warning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-spans-warning.js","sourceRoot":"","sources":["../../../../../../src/logic/pretty-printing/common/constants/missing-spans-warning.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAElB,QAAA,mBAAmB,GAAG,OAAO,oBAAK,CAAC,IAAI,CAAC,uDAAuD,CAAC,EAAE,CAAC"}
|
|
@@ -3,15 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.formatErrorTitle = void 0;
|
|
7
7
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
-
const
|
|
8
|
+
const formatErrorTitle = (errorType, message, failuresLength, failureIndex) => {
|
|
9
9
|
const failuresCount = failuresLength > 1
|
|
10
10
|
? picocolors_1.default.bgRed(picocolors_1.default.white(` #${failureIndex + 1} -`))
|
|
11
11
|
: '';
|
|
12
12
|
const type = picocolors_1.default.bgRed(picocolors_1.default.white(` ${errorType ?? 'Unknown error'} `));
|
|
13
13
|
const formattedMessage = picocolors_1.default.bold(picocolors_1.default.white(` • ${message}`));
|
|
14
|
-
return `💥 ${failuresCount}${type}${formattedMessage}
|
|
14
|
+
return [`💥 ${failuresCount}${type}${formattedMessage}`];
|
|
15
15
|
};
|
|
16
|
-
exports.
|
|
17
|
-
//# sourceMappingURL=format-
|
|
16
|
+
exports.formatErrorTitle = formatErrorTitle;
|
|
17
|
+
//# sourceMappingURL=format-error-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-error-title.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/common/format-error-title.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAExB,MAAM,gBAAgB,GAAG,CAC9B,SAAkB,EAClB,OAAgB,EAChB,cAAsB,EACtB,YAAoB,EACV,EAAE;IACZ,MAAM,aAAa,GACjB,cAAc,GAAG,CAAC;QAChB,CAAC,CAAC,oBAAK,CAAC,KAAK,CAAC,oBAAK,CAAC,KAAK,CAAC,KAAK,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,IAAI,GAAG,oBAAK,CAAC,KAAK,CACtB,oBAAK,CAAC,KAAK,CAAC,IAAK,SAAgC,IAAI,eAAe,GAAG,CAAC,CACzE,CAAC;IACF,MAAM,gBAAgB,GAAG,oBAAK,CAAC,IAAI,CAAC,oBAAK,CAAC,KAAK,CAAC,MAAM,OAAiB,EAAE,CAAC,CAAC,CAAC;IAE5E,OAAO,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,gBAAgB,EAAE,CAAC,CAAC;AAC3D,CAAC,CAAC;AAhBW,QAAA,gBAAgB,oBAgB3B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatSpanAttributes = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const maybePrintPipe = (isLastEntry) => isLastEntry ? ' ' : picocolors_1.default.gray('│');
|
|
9
|
+
const formatSpanAttributes = (attributes, isLastEntry) => {
|
|
10
|
+
const entries = Object.entries(attributes);
|
|
11
|
+
if (entries.length === 0) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const lines = Array.from(entries).map(([key, value]) => `${maybePrintPipe(isLastEntry)} ${picocolors_1.default.blue(key)}${picocolors_1.default.gray(':')} ${value}`);
|
|
15
|
+
return `\r\n${lines.join('\r\n')}`;
|
|
16
|
+
};
|
|
17
|
+
exports.formatSpanAttributes = formatSpanAttributes;
|
|
18
|
+
//# sourceMappingURL=format-span-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-span-attributes.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/common/format-span-attributes.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAE/B,MAAM,cAAc,GAAG,CAAC,WAAoB,EAAE,EAAE,CAC9C,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,oBAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/B,MAAM,oBAAoB,GAAG,CAClC,UAAmC,EACnC,WAAoB,EACpB,EAAE;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CACnC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CACf,GAAG,cAAc,CAAC,WAAW,CAAC,OAAO,oBAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,oBAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE,CACpF,CAAC;IAEF,OAAO,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AACrC,CAAC,CAAC;AAfW,QAAA,oBAAoB,wBAe/B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatSpanDuration = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const formatSpanDuration = (durationInMs, isLastEntry) => `\r\n${isLastEntry ? ' ' : picocolors_1.default.gray('│')} ~ ${durationInMs}ms`;
|
|
9
|
+
exports.formatSpanDuration = formatSpanDuration;
|
|
10
|
+
//# sourceMappingURL=format-span-duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-span-duration.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/common/format-span-duration.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAExB,MAAM,kBAAkB,GAAG,CAChC,YAA6B,EAC7B,WAAoB,EACpB,EAAE,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,oBAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,YAAY,IAAI,CAAC;AAH1D,QAAA,kBAAkB,sBAGwC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatTitle = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const formatTitle = (errorsCount) => {
|
|
9
|
+
if (errorsCount === 1) {
|
|
10
|
+
return [''];
|
|
11
|
+
}
|
|
12
|
+
const libName = picocolors_1.default.cyanBright(`${picocolors_1.default.underline(picocolors_1.default.bold('effect-errors'))}`);
|
|
13
|
+
const title = picocolors_1.default.bold(picocolors_1.default.redBright(`${errorsCount} error${errorsCount > 1 ? 's' : ''} occured`));
|
|
14
|
+
return ['', `${libName} ❌ - ${title}`, '', ''];
|
|
15
|
+
};
|
|
16
|
+
exports.formatTitle = formatTitle;
|
|
17
|
+
//# sourceMappingURL=format-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-title.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/common/format-title.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAExB,MAAM,WAAW,GAAG,CAAC,WAAmB,EAAY,EAAE;IAC3D,IAAI,WAAW,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,oBAAK,CAAC,UAAU,CAC9B,GAAG,oBAAK,CAAC,SAAS,CAAC,oBAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,CAClD,CAAC;IACF,MAAM,KAAK,GAAG,oBAAK,CAAC,IAAI,CACtB,oBAAK,CAAC,SAAS,CACb,GAAG,WAAW,SAAS,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU,CAC5D,CACF,CAAC;IAEF,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,QAAQ,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC,CAAC;AAfW,QAAA,WAAW,eAetB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./format-error-title.js"), exports);
|
|
18
|
+
__exportStar(require("./format-span-attributes.js"), exports);
|
|
19
|
+
__exportStar(require("./format-span-duration.js"), exports);
|
|
20
|
+
__exportStar(require("./maybe-warn-about-plain-strings.js"), exports);
|
|
21
|
+
__exportStar(require("./spans-stack-trailing-char.js"), exports);
|
|
22
|
+
__exportStar(require("./constants/missing-spans-warning.js"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,8DAA4C;AAC5C,4DAA0C;AAC1C,sEAAoD;AACpD,iEAA+C;AAE/C,uEAAqD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.maybeWarnAboutPlainStrings = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const maybeWarnAboutPlainStrings = (isPlainString) => {
|
|
9
|
+
if (!isPlainString) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
return [
|
|
13
|
+
'',
|
|
14
|
+
picocolors_1.default.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.'),
|
|
15
|
+
];
|
|
16
|
+
};
|
|
17
|
+
exports.maybeWarnAboutPlainStrings = maybeWarnAboutPlainStrings;
|
|
18
|
+
//# sourceMappingURL=maybe-warn-about-plain-strings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maybe-warn-about-plain-strings.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/common/maybe-warn-about-plain-strings.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAExB,MAAM,0BAA0B,GAAG,CACxC,aAAsB,EACZ,EAAE;IACZ,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,EAAE;QACF,oBAAK,CAAC,IAAI,CACR,gPAAgP,CACjP;KACF,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,0BAA0B,8BAarC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spans-stack-trailing-char.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/common/spans-stack-trailing-char.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAExB,MAAM,qBAAqB,GAAG,CAAC,WAAoB,EAAE,EAAE,CAC5D,WAAW,CAAC,CAAC,CAAC,oBAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AADrC,QAAA,qBAAqB,yBACgB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./maybe-print-node-stacktrace.js"), exports);
|
|
18
|
+
__exportStar(require("./spans-timeline/maybe-print-spans-timeline.js"), exports);
|
|
19
|
+
__exportStar(require("./print-effect-stacktrace.js"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/failures/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,iFAA+D;AAC/D,+DAA6C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.maybePrintNodeStacktrace = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const filter_stack_js_1 = require("../../stack/filter-stack.js");
|
|
9
|
+
const maybePrintNodeStacktrace = (stack, isPlainString, { stripCwd, hideStackTrace }) => {
|
|
10
|
+
if (hideStackTrace) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
if (stack !== undefined) {
|
|
14
|
+
const line = [
|
|
15
|
+
'',
|
|
16
|
+
`${picocolors_1.default.bold(picocolors_1.default.red('◯'))} ${picocolors_1.default.red('Node Stacktrace')} 🚨`,
|
|
17
|
+
`${picocolors_1.default.red((0, filter_stack_js_1.filterStack)(stack, 'node', stripCwd === true))}`,
|
|
18
|
+
`${picocolors_1.default.red('┴')}`,
|
|
19
|
+
].join('\r\n');
|
|
20
|
+
return [line];
|
|
21
|
+
}
|
|
22
|
+
if (!isPlainString) {
|
|
23
|
+
const line = [
|
|
24
|
+
'',
|
|
25
|
+
`${picocolors_1.default.gray('ℹ️ Consider using a yieldable error such as Data.TaggedError and Schema.TaggedError to get a stacktrace.')}`,
|
|
26
|
+
].join('\r\n');
|
|
27
|
+
return [line];
|
|
28
|
+
}
|
|
29
|
+
return [];
|
|
30
|
+
};
|
|
31
|
+
exports.maybePrintNodeStacktrace = maybePrintNodeStacktrace;
|
|
32
|
+
//# sourceMappingURL=maybe-print-node-stacktrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maybe-print-node-stacktrace.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/failures/maybe-print-node-stacktrace.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAG/B,iEAA0D;AAEnD,MAAM,wBAAwB,GAAG,CACtC,KAAyB,EACzB,aAAsB,EACtB,EAAE,QAAQ,EAAE,cAAc,EAAsB,EACtC,EAAE;IACZ,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG;YACX,EAAE;YACF,GAAG,oBAAK,CAAC,IAAI,CAAC,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,oBAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK;YAClE,GAAG,oBAAK,CAAC,GAAG,CAAC,IAAA,6BAAW,EAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC,CAAC,EAAE;YAC7D,GAAG,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;SACpB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEf,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG;YACX,EAAE;YACF,GAAG,oBAAK,CAAC,IAAI,CAAC,2GAA2G,CAAC,EAAE;SAC7H,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEf,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AA7BW,QAAA,wBAAwB,4BA6BnC"}
|
package/cjs/logic/pretty-printing/{print-effect-stacktrace.js → failures/print-effect-stacktrace.js}
RENAMED
|
@@ -5,13 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.printEffectStacktrace = void 0;
|
|
7
7
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
-
const filter_stack_js_1 = require("
|
|
9
|
-
const printEffectStacktrace = (
|
|
8
|
+
const filter_stack_js_1 = require("../../stack/filter-stack.js");
|
|
9
|
+
const printEffectStacktrace = (spanAttributesStack, { stripCwd }) => {
|
|
10
10
|
if (spanAttributesStack === undefined || spanAttributesStack.length === 0) {
|
|
11
|
-
return;
|
|
11
|
+
return [];
|
|
12
12
|
}
|
|
13
13
|
const cleanedStack = `│ ${(0, filter_stack_js_1.filterStack)(spanAttributesStack.join('\r\n│ '), 'effect', stripCwd === true)}`;
|
|
14
|
-
|
|
14
|
+
const message = [
|
|
15
|
+
'',
|
|
16
|
+
`${picocolors_1.default.bold(picocolors_1.default.red('◯'))} ${picocolors_1.default.red('Sources')} 🕵️`,
|
|
17
|
+
`${picocolors_1.default.red(cleanedStack)}`,
|
|
18
|
+
`${picocolors_1.default.red('┴')}`,
|
|
19
|
+
].join('\r\n');
|
|
20
|
+
return [message];
|
|
15
21
|
};
|
|
16
22
|
exports.printEffectStacktrace = printEffectStacktrace;
|
|
17
23
|
//# sourceMappingURL=print-effect-stacktrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"print-effect-stacktrace.js","sourceRoot":"","sources":["../../../../../src/logic/pretty-printing/failures/print-effect-stacktrace.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAG/B,iEAA0D;AAEnD,MAAM,qBAAqB,GAAG,CACnC,mBAAyC,EACzC,EAAE,QAAQ,EAAsB,EACtB,EAAE;IACZ,IAAI,mBAAmB,KAAK,SAAS,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,IAAA,6BAAW,EAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC;IAEzG,MAAM,OAAO,GAAG;QACd,EAAE;QACF,GAAG,oBAAK,CAAC,IAAI,CAAC,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,oBAAK,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM;QAC3D,GAAG,oBAAK,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;QAC5B,GAAG,oBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;KACpB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAC;AAlBW,QAAA,qBAAqB,yBAkBhC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractSpans = void 0;
|
|
4
|
+
const effect_1 = require("effect");
|
|
5
|
+
const extractSpans = (span) => {
|
|
6
|
+
let current = span;
|
|
7
|
+
const spans = [];
|
|
8
|
+
while (current !== undefined && current._tag === 'Span') {
|
|
9
|
+
spans.push(current);
|
|
10
|
+
current = effect_1.Option.getOrUndefined(current.parent);
|
|
11
|
+
}
|
|
12
|
+
return spans;
|
|
13
|
+
};
|
|
14
|
+
exports.extractSpans = extractSpans;
|
|
15
|
+
//# sourceMappingURL=extract-spans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-spans.js","sourceRoot":"","sources":["../../../../../../src/logic/pretty-printing/failures/spans-timeline/extract-spans.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAGzB,MAAM,YAAY,GAAG,CAAC,IAAsB,EAAE,EAAE;IACrD,IAAI,OAAO,GAAwB,IAAI,CAAC;IAExC,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,eAAM,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAVW,QAAA,YAAY,gBAUvB"}
|