(options?: ErrorOptions)
| 9297 | * @since 4.0.0 |
| 9298 | */ |
| 9299 | export function ErrorInstance(options?: ErrorOptions): ErrorInstance { |
| 9300 | const key = getErrorOptionsKey(options) |
| 9301 | const cached = errorSchemaCache[key] |
| 9302 | if (cached !== undefined) { |
| 9303 | return cached |
| 9304 | } |
| 9305 | const normalizedOptions = getErrorOptions(key) |
| 9306 | const schema = instanceOf(globalThis.Error, { |
| 9307 | representation: { |
| 9308 | id: "effect/schema/Error", |
| 9309 | payload: normalizedOptions ?? null |
| 9310 | }, |
| 9311 | expected: "Error", |
| 9312 | toCodecJson: () => link<globalThis.Error>()(JsonError, SchemaTransformation.errorFromJsonError(normalizedOptions)) |
| 9313 | }) |
| 9314 | errorSchemaCache[key] = schema |
| 9315 | return schema |
| 9316 | } |
| 9317 | /** |
| 9318 | * Type-level representation of {@link Defect}. |
| 9319 | * |
nothing calls this directly
no test coverage detected