Hyperlinkv0.8.0-beta.28

Runtime

Runtime.errorReportedtypeeffect/Runtime.ts:354
"~effect/Runtime/errorReported"

Type-level key for the Runtime.errorReported marker.

When to use

Use to type properties keyed by Runtime.errorReported on custom error values.

symbols
Source effect/Runtime.ts:35446 lines
export type errorReported = "~effect/Runtime/errorReported"

/**
 * Defines the runtime marker that controls default `runMain` error logging for an error.
 *
 * **When to use**
 *
 * Use when you need error classes reported by application code to avoid being
 * logged again by the default main runner.
 *
 * **Details**
 *
 * Set `[Runtime.errorReported]` to `false` on an error object to suppress the
 * runtime log because the error has already been reported. Omitted or
 * non-boolean values are treated as `true`, so failures are logged by default.
 *
 * **Gotchas**
 *
 * This marker controls only automatic error logging. It does not change the
 * failure Cause or the process exit code.
 * `makeRunMain` reads the marker from `Cause.squash(cause)`, so for causes
 * with multiple failures, the squashed error determines whether default logging
 * is suppressed.
 *
 * **Example** (Suppressing error reporting)
 *
 * ```ts
 * import { Data, Effect, Runtime } from "effect"
 * import { NodeRuntime } from "@effect/platform-node"
 *
 * class MyError extends Data.TaggedError("MyError") {
 *   readonly [Runtime.errorReported] = false
 * }
 *
 * // If the program fails with MyError, the process will exit with code 1 but
 * // no error will be logged.
 * NodeRuntime.runMain(Effect.fail(new MyError()))
 * ```
 *
 * @see {@link errorExitCode} for controlling failure exit codes
 * @see {@link getErrorReported} for reading the marker from unknown error values
 *
 * @category symbols
 * @since 4.0.0
 */
export const errorReported: errorReported = "~effect/Runtime/errorReported"
Referenced by 1 symbols