Skip to content

Parallel and Sequential Errors

When working with Effect, if an error occurs, the default behavior is to fail with the first error encountered.

Example (Failing on the First Error)

Here, the program fails with the first error it encounters, "Oh uh!".

1
import {
import Effect
Effect
} from "effect"
2
3
const
const fail: Effect.Effect<never, string, never>
fail
=
import Effect
Effect
.
const fail: <string>(error: string) => Effect.Effect<never, string, never>

Creates an `Effect` that represents a recoverable error. This `Effect` does not succeed but instead fails with the provided error. The failure can be of any type, and will propagate through the effect pipeline unless handled. Use this function when you want to explicitly signal an error in an `Effect` computation. The failed effect can later be handled with functions like {@link catchAll } or {@link catchTag } .

fail
("Oh uh!")
4
const
const die: Effect.Effect<never, never, never>
die
=
import Effect
Effect
.
const dieMessage: (message: string) => Effect.Effect<never>

Returns an effect that dies with a `RuntimeException` having the specified text message. This method can be used for terminating a fiber because a defect has been detected in the code.

dieMessage
("Boom!")
5
6
// Run both effects sequentially
7
const
const program: Effect.Effect<[never, never], string, never>
program
=
import Effect
Effect
.
const all: <readonly [Effect.Effect<never, string, never>, Effect.Effect<never, never, never>], { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined; readonly discard?: boolean | undefined; readonly mode?: "default" | "validate" | "either" | undefined; readonly concurrentFinalizers?: boolean | undefined; }>(arg: readonly [...], options?: { ...; } | undefined) => Effect.Effect<...>

Runs all the provided effects in sequence respecting the structure provided in input. Supports multiple arguments, a single argument tuple / array or record / struct.

all
([
const fail: Effect.Effect<never, string, never>
fail
,
const die: Effect.Effect<never, never, never>
die
])
8
9
import Effect
Effect
.
const runPromiseExit: <[never, never], string>(effect: Effect.Effect<[never, never], string, never>, options?: { readonly signal?: AbortSignal; } | undefined) => Promise<Exit<[never, never], string>>

Executes an effect and returns a `Promise` that resolves with an `Exit` describing the result. Use `runPromiseExit` when you need detailed information about the outcome of the effect, including success or failure, and you want to work with Promises.

runPromiseExit
(
const program: Effect.Effect<[never, never], string, never>
program
).
(method) Promise<Exit<[never, never], string>>.then<void, never>(onfulfilled?: ((value: Exit<[never, never], string>) => void | PromiseLike<void>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<never>) | null | undefined): Promise<...>

Attaches callbacks for the resolution and/or rejection of the Promise.

then
(
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
)
10
/*
11
Output:
12
{
13
_id: 'Exit',
14
_tag: 'Failure',
15
cause: { _id: 'Cause', _tag: 'Fail', failure: 'Oh uh!' }
16
}
17
*/

In some cases, you might encounter multiple errors, especially during concurrent computations. When tasks are run concurrently, multiple errors can happen at the same time.

Example (Handling Multiple Errors in Concurrent Computations)

In this example, both the fail and die effects are executed concurrently. Since both fail, the program will report multiple errors in the output.

1
import {
import Effect
Effect
} from "effect"
2
3
const
const fail: Effect.Effect<never, string, never>
fail
=
import Effect
Effect
.
const fail: <string>(error: string) => Effect.Effect<never, string, never>

Creates an `Effect` that represents a recoverable error. This `Effect` does not succeed but instead fails with the provided error. The failure can be of any type, and will propagate through the effect pipeline unless handled. Use this function when you want to explicitly signal an error in an `Effect` computation. The failed effect can later be handled with functions like {@link catchAll } or {@link catchTag } .

fail
("Oh uh!")
4
const
const die: Effect.Effect<never, never, never>
die
=
import Effect
Effect
.
const dieMessage: (message: string) => Effect.Effect<never>

Returns an effect that dies with a `RuntimeException` having the specified text message. This method can be used for terminating a fiber because a defect has been detected in the code.

dieMessage
("Boom!")
5
6
// Run both effects concurrently
7
const
const program: Effect.Effect<void, string, never>
program
=
import Effect
Effect
.
const all: <readonly [Effect.Effect<never, string, never>, Effect.Effect<never, never, never>], { concurrency: "unbounded"; }>(arg: readonly [Effect.Effect<never, string, never>, Effect.Effect<...>], options?: { ...; } | undefined) => Effect.Effect<...>

Runs all the provided effects in sequence respecting the structure provided in input. Supports multiple arguments, a single argument tuple / array or record / struct.

all
([
const fail: Effect.Effect<never, string, never>
fail
,
const die: Effect.Effect<never, never, never>
die
], {
8
(property) concurrency: "unbounded"
concurrency
: "unbounded"
9
}).
(method) Pipeable.pipe<Effect.Effect<[never, never], string, never>, Effect.Effect<void, string, never>>(this: Effect.Effect<...>, ab: (_: Effect.Effect<[never, never], string, never>) => Effect.Effect<void, string, never>): Effect.Effect<...> (+21 overloads)
pipe
(
import Effect
Effect
.
const asVoid: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<void, E, R>

This function maps the success value of an `Effect` value to `void`. If the original `Effect` value succeeds, the returned `Effect` value will also succeed. If the original `Effect` value fails, the returned `Effect` value will fail with the same error.

asVoid
)
10
11
import Effect
Effect
.
const runPromiseExit: <void, string>(effect: Effect.Effect<void, string, never>, options?: { readonly signal?: AbortSignal; } | undefined) => Promise<Exit<void, string>>

Executes an effect and returns a `Promise` that resolves with an `Exit` describing the result. Use `runPromiseExit` when you need detailed information about the outcome of the effect, including success or failure, and you want to work with Promises.

runPromiseExit
(
const program: Effect.Effect<void, string, never>
program
).
(method) Promise<Exit<void, string>>.then<void, never>(onfulfilled?: ((value: Exit<void, string>) => void | PromiseLike<void>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<never>) | null | undefined): Promise<...>

Attaches callbacks for the resolution and/or rejection of the Promise.

then
(
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
)
12
/*
13
Output:
14
{
15
_id: 'Exit',
16
_tag: 'Failure',
17
cause: {
18
_id: 'Cause',
19
_tag: 'Parallel',
20
left: { _id: 'Cause', _tag: 'Fail', failure: 'Oh uh!' },
21
right: { _id: 'Cause', _tag: 'Die', defect: [Object] }
22
}
23
}
24
*/

Effect provides a function called Effect.parallelErrors that captures all failure errors from concurrent operations in the error channel.

Example (Capturing Multiple Concurrent Failures)

In this example, Effect.parallelErrors combines the errors from fail1 and fail2 into a single error.

1
import {
import Effect
Effect
} from "effect"
2
3
const
const fail1: Effect.Effect<never, string, never>
fail1
=
import Effect
Effect
.
const fail: <string>(error: string) => Effect.Effect<never, string, never>

Creates an `Effect` that represents a recoverable error. This `Effect` does not succeed but instead fails with the provided error. The failure can be of any type, and will propagate through the effect pipeline unless handled. Use this function when you want to explicitly signal an error in an `Effect` computation. The failed effect can later be handled with functions like {@link catchAll } or {@link catchTag } .

fail
("Oh uh!")
4
const
const fail2: Effect.Effect<never, string, never>
fail2
=
import Effect
Effect
.
const fail: <string>(error: string) => Effect.Effect<never, string, never>

Creates an `Effect` that represents a recoverable error. This `Effect` does not succeed but instead fails with the provided error. The failure can be of any type, and will propagate through the effect pipeline unless handled. Use this function when you want to explicitly signal an error in an `Effect` computation. The failed effect can later be handled with functions like {@link catchAll } or {@link catchTag } .

fail
("Oh no!")
5
const
const die: Effect.Effect<never, never, never>
die
=
import Effect
Effect
.
const dieMessage: (message: string) => Effect.Effect<never>

Returns an effect that dies with a `RuntimeException` having the specified text message. This method can be used for terminating a fiber because a defect has been detected in the code.

dieMessage
("Boom!")
6
7
// Run all effects concurrently and capture all errors
8
const
const program: Effect.Effect<void, string[], never>
program
=
import Effect
Effect
.
const all: <readonly [Effect.Effect<never, string, never>, Effect.Effect<never, string, never>, Effect.Effect<never, never, never>], { concurrency: "unbounded"; }>(arg: readonly [...], options?: { ...; } | undefined) => Effect.Effect<...>

Runs all the provided effects in sequence respecting the structure provided in input. Supports multiple arguments, a single argument tuple / array or record / struct.

all
([
const fail1: Effect.Effect<never, string, never>
fail1
,
const fail2: Effect.Effect<never, string, never>
fail2
,
const die: Effect.Effect<never, never, never>
die
], {
9
(property) concurrency: "unbounded"
concurrency
: "unbounded"
10
}).
(method) Pipeable.pipe<Effect.Effect<[never, never, never], string, never>, Effect.Effect<void, string, never>, Effect.Effect<void, string[], never>>(this: Effect.Effect<...>, ab: (_: Effect.Effect<[never, never, never], string, never>) => Effect.Effect<...>, bc: (_: Effect.Effect<...>) => Effect.Effect<...>): Effect.Effect<...> (+21 overloads)
pipe
(
import Effect
Effect
.
const asVoid: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<void, E, R>

This function maps the success value of an `Effect` value to `void`. If the original `Effect` value succeeds, the returned `Effect` value will also succeed. If the original `Effect` value fails, the returned `Effect` value will fail with the same error.

asVoid
,
import Effect
Effect
.
const parallelErrors: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, Array<E>, R>

Exposes all parallel errors in a single call.

parallelErrors
)
11
12
import Effect
Effect
.
const runPromiseExit: <void, string[]>(effect: Effect.Effect<void, string[], never>, options?: { readonly signal?: AbortSignal; } | undefined) => Promise<Exit<void, string[]>>

Executes an effect and returns a `Promise` that resolves with an `Exit` describing the result. Use `runPromiseExit` when you need detailed information about the outcome of the effect, including success or failure, and you want to work with Promises.

runPromiseExit
(
const program: Effect.Effect<void, string[], never>
program
).
(method) Promise<Exit<void, string[]>>.then<void, never>(onfulfilled?: ((value: Exit<void, string[]>) => void | PromiseLike<void>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<never>) | null | undefined): Promise<...>

Attaches callbacks for the resolution and/or rejection of the Promise.

then
(
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
)
13
/*
14
Output:
15
{
16
_id: 'Exit',
17
_tag: 'Failure',
18
cause: { _id: 'Cause', _tag: 'Fail', failure: [ 'Oh uh!', 'Oh no!' ] }
19
}
20
*/

When working with resource-safety operators like Effect.ensuring, you may encounter multiple sequential errors. This happens because regardless of whether the original effect has any errors or not, the finalizer is uninterruptible and will always run.

Example (Handling Multiple Sequential Errors)

In this example, both fail and the finalizer die result in sequential errors, and both are captured.

1
import {
import Effect
Effect
} from "effect"
2
3
// Simulate an effect that fails
4
const
const fail: Effect.Effect<never, string, never>
fail
=
import Effect
Effect
.
const fail: <string>(error: string) => Effect.Effect<never, string, never>

Creates an `Effect` that represents a recoverable error. This `Effect` does not succeed but instead fails with the provided error. The failure can be of any type, and will propagate through the effect pipeline unless handled. Use this function when you want to explicitly signal an error in an `Effect` computation. The failed effect can later be handled with functions like {@link catchAll } or {@link catchTag } .

fail
("Oh uh!")
5
6
// Simulate a finalizer that causes a defect
7
const
const die: Effect.Effect<never, never, never>
die
=
import Effect
Effect
.
const dieMessage: (message: string) => Effect.Effect<never>

Returns an effect that dies with a `RuntimeException` having the specified text message. This method can be used for terminating a fiber because a defect has been detected in the code.

dieMessage
("Boom!")
8
9
// The finalizer 'die' will always run, even if 'fail' fails
10
const
const program: Effect.Effect<never, string, never>
program
=
const fail: Effect.Effect<never, string, never>
fail
.
(method) Pipeable.pipe<Effect.Effect<never, string, never>, Effect.Effect<never, string, never>>(this: Effect.Effect<...>, ab: (_: Effect.Effect<never, string, never>) => Effect.Effect<never, string, never>): Effect.Effect<...> (+21 overloads)
pipe
(
import Effect
Effect
.
const ensuring: <never, never>(finalizer: Effect.Effect<never, never, never>) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R> (+1 overload)

Returns an effect that, if this effect _starts_ execution, then the specified `finalizer` is guaranteed to be executed, whether this effect succeeds, fails, or is interrupted. For use cases that need access to the effect's result, see `onExit`. Finalizers offer very powerful guarantees, but they are low-level, and should generally not be used for releasing resources. For higher-level logic built on `ensuring`, see the `acquireRelease` family of methods.

ensuring
(
const die: Effect.Effect<never, never, never>
die
))
11
12
import Effect
Effect
.
const runPromiseExit: <never, string>(effect: Effect.Effect<never, string, never>, options?: { readonly signal?: AbortSignal; } | undefined) => Promise<Exit<never, string>>

Executes an effect and returns a `Promise` that resolves with an `Exit` describing the result. Use `runPromiseExit` when you need detailed information about the outcome of the effect, including success or failure, and you want to work with Promises.

runPromiseExit
(
const program: Effect.Effect<never, string, never>
program
).
(method) Promise<Exit<never, string>>.then<void, never>(onfulfilled?: ((value: Exit<never, string>) => void | PromiseLike<void>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<never>) | null | undefined): Promise<...>

Attaches callbacks for the resolution and/or rejection of the Promise.

then
(
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
)
13
/*
14
Output:
15
{
16
_id: 'Exit',
17
_tag: 'Failure',
18
cause: {
19
_id: 'Cause',
20
_tag: 'Sequential',
21
left: { _id: 'Cause', _tag: 'Fail', failure: 'Oh uh!' },
22
right: { _id: 'Cause', _tag: 'Die', defect: [Object] }
23
}
24
}
25
*/