{
  "id": "@typed/fx#Fx.onError",
  "canonicalId": "@typed/fx/Fx#onError",
  "symbol": {
    "id": "@typed/fx#Fx.onError",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Fx.onError",
    "kind": "constant",
    "signatures": [
      "export declare const onError: {\n    <E, X, R2>(cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E, R | R2>;\n    <A, E, R, X, R2>(self: Fx<A, E, R>, cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): Fx<A, E, R | R2>;\n};"
    ],
    "summary": "Runs cleanup after the source reports a failure cause.",
    "sections": {
      "Why": "Failure-only observation belongs at the stream boundary when cleanup needs\nthe complete Cause rather than merely the typed error.",
      "Ownership and lifetime": "The original cause is delivered downstream first. Cleanup runs only if that\ndownstream `onFailure` Effect succeeds; if the sink itself fails or interrupts,\n`flatMap` never reaches cleanup. Typed cleanup failure is impossible by\nsignature, but `Effect.ignore` does not suppress defects or interruption:\neither can fail or interrupt the run after the source Cause was handled. Its\nservices are required for the subscription, and it does not run after success."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { onError } from \"@typed/fx/Fx\"\nimport { fail } from \"@typed/fx/Fx\"\n\nconst logged = onError(fail(\"offline\"), (cause) => Effect.logError(cause))"
      },
      {
        "language": "text",
        "code": "A cleanup defect is not a typed failure\n```ts\nimport { Effect } from \"effect\"\nimport { onError } from \"@typed/fx/Fx\"\nimport { fail } from \"@typed/fx/Fx\"\n\nconst defectiveCleanup = onError(fail(\"offline\"), () => Effect.die(\"logger defect\"))\n```"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/onError.ts",
      "line": 47
    },
    "since": "1.0.0",
    "category": "Observing failures"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Fx.onError",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Fx",
    "qualifiedName": "Fx.onError",
    "declarationKey": "declaration:45d441f17b4c7186458db70c",
    "family": "variable",
    "signatures": [
      "export declare const onError: {\n    <E, X, R2>(cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E, R | R2>;\n    <A, E, R, X, R2>(self: Fx<A, E, R>, cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): Fx<A, E, R | R2>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/onError.ts",
        "start": {
          "line": 47,
          "column": 14
        },
        "end": {
          "line": 70,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/onError.ts",
        "start": {
          "line": 48,
          "column": 3
        },
        "end": {
          "line": 50,
          "column": 52
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/onError.ts",
        "start": {
          "line": 52,
          "column": 3
        },
        "end": {
          "line": 55,
          "column": 23
        }
      }
    ],
    "aliases": [
      "@typed/fx/Fx#onError"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Fx",
    "static": false,
    "importedFrom": "declaration:45d441f17b4c7186458db70c"
  },
  "declaration": {
    "declarationKey": "declaration:45d441f17b4c7186458db70c",
    "name": "onError",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const onError: {\n    <E, X, R2>(cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E, R | R2>;\n    <A, E, R, X, R2>(self: Fx<A, E, R>, cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): Fx<A, E, R | R2>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/onError.ts",
            "start": {
              "line": 47,
              "column": 14
            },
            "end": {
              "line": 70,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<E, X, R2>(cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E, R | R2>;",
          "<A, E, R, X, R2>(self: Fx<A, E, R>, cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): Fx<A, E, R | R2>;"
        ],
        "typeParameters": [
          "E",
          "X",
          "R2",
          "A",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/onError.ts",
            "start": {
              "line": 48,
              "column": 3
            },
            "end": {
              "line": 50,
              "column": 52
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/onError.ts",
            "start": {
              "line": 52,
              "column": 3
            },
            "end": {
              "line": 55,
              "column": 23
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const onError: {\n    <E, X, R2>(cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E, R | R2>;\n    <A, E, R, X, R2>(self: Fx<A, E, R>, cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): Fx<A, E, R | R2>;\n};"
    ],
    "typeParameters": [
      "E",
      "X",
      "R2",
      "A",
      "R"
    ],
    "summary": "Runs cleanup after the source reports a failure cause.",
    "sections": {
      "Why": "Failure-only observation belongs at the stream boundary when cleanup needs\nthe complete Cause rather than merely the typed error.",
      "Ownership and lifetime": "The original cause is delivered downstream first. Cleanup runs only if that\ndownstream `onFailure` Effect succeeds; if the sink itself fails or interrupts,\n`flatMap` never reaches cleanup. Typed cleanup failure is impossible by\nsignature, but `Effect.ignore` does not suppress defects or interruption:\neither can fail or interrupt the run after the source Cause was handled. Its\nservices are required for the subscription, and it does not run after success."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { onError } from \"@typed/fx/Fx\"\nimport { fail } from \"@typed/fx/Fx\"\n\nconst logged = onError(fail(\"offline\"), (cause) => Effect.logError(cause))"
      },
      {
        "language": "text",
        "code": "A cleanup defect is not a typed failure\n```ts\nimport { Effect } from \"effect\"\nimport { onError } from \"@typed/fx/Fx\"\nimport { fail } from \"@typed/fx/Fx\"\n\nconst defectiveCleanup = onError(fail(\"offline\"), () => Effect.die(\"logger defect\"))\n```"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/onError.ts",
        "start": {
          "line": 47,
          "column": 14
        },
        "end": {
          "line": 70,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/onError.ts",
        "start": {
          "line": 48,
          "column": 3
        },
        "end": {
          "line": 50,
          "column": 52
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/onError.ts",
        "start": {
          "line": 52,
          "column": 3
        },
        "end": {
          "line": 55,
          "column": 23
        }
      }
    ],
    "since": "1.0.0",
    "category": "Observing failures"
  }
}
