QuitErrorRepresents an error that occurs when a user attempts to
quit out of a Terminal prompt for input (usually by entering ctrl+c).
When to use
Use when implementing terminal input or prompts that need to signal user-requested cancellation through the typed error channel.
export class class QuitErrorclass QuitError {
effect/platform/Terminal/QuitError: 'effect/platform/Terminal/QuitError';
_tag: 'QuitError';
name: string;
message: string;
stack: string;
cause: unknown;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
Represents an error that occurs when a user attempts to
quit out of a Terminal prompt for input (usually by entering ctrl+c).
When to use
Use when implementing terminal input or prompts that need to signal
user-requested cancellation through the typed error channel.
QuitError extends import SchemaSchema.const ErrorClass: {
<Self = never, Brand = {}>(
identifier: string
): {
<Fields extends Struct.Fields>(
fields: Fields,
annotations?: Annotations.Declaration<
Self,
readonly [Struct<Fields>]
>
): [Self] extends [never]
? MissingSelfGeneric<"Schema.ErrorClass">
: Class<
Self,
Struct<Fields>,
Cause_.YieldableError & Brand
>
<S extends Struct<Struct.Fields>>(
schema: S,
annotations?: Annotations.Declaration<
Self,
readonly [S]
>
): [Self] extends [never]
? MissingSelfGeneric<"Schema.ErrorClass">
: Class<
Self,
S,
Cause_.YieldableError & Brand
>
}
}
Creates a schema-backed error class that can be used as a typed,
yieldable error in Effect programs. Combines
Class
validation with
the YieldableError interface so instances can be yielded directly inside
Effect.gen.
Example (Schema-backed error)
import { Effect, Schema } from "effect"
class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
id: Schema.Number
}) {}
const program = Effect.gen(function*() {
yield* new NotFound({ id: 1 })
})
ErrorClass<class QuitErrorclass QuitError {
effect/platform/Terminal/QuitError: 'effect/platform/Terminal/QuitError';
_tag: 'QuitError';
name: string;
message: string;
stack: string;
cause: unknown;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
Represents an error that occurs when a user attempts to
quit out of a Terminal prompt for input (usually by entering ctrl+c).
When to use
Use when implementing terminal input or prompts that need to signal
user-requested cancellation through the typed error channel.
QuitError>("QuitError")({
_tag: Schema.tag<"QuitError">(property) _tag: {
Type: S["Type"];
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
schema: S;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<'QuitError', readonly []>) => Schema.withConstructorDefault<Schema.Literal<'QuitError'>>;
annotateKey: (annotations: Schema.Annotations.Key<'QuitError'>) => Schema.withConstructorDefault<Schema.Literal<'QuitError'>>;
check: (checks_0: Check<'QuitError'>, ...checks: Array<Check<'QuitError'>>) => Schema.withConstructorDefault<Schema.Literal<'QuitError'>>;
rebuild: (ast: Literal) => Schema.withConstructorDefault<Schema.Literal<'QuitError'>>;
make: (input: 'QuitError', options?: MakeOptions) => 'QuitError';
makeOption: (input: 'QuitError', options?: MakeOptions) => Option_.Option<'QuitError'>;
makeEffect: (input: 'QuitError', options?: MakeOptions) => Effect.Effect<'QuitError', SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
_tag: import SchemaSchema.function tag<
Tag extends SchemaAST.LiteralValue
>(literal: Tag): tag<Tag>
Combines a
Literal
schema with
withConstructorDefault
, making it ideal
for discriminator fields in tagged unions. When constructing via make, the
_tag field can be omitted and will be filled automatically.
Example (Defining a discriminated union tag)
import { Schema } from "effect"
const A = Schema.Struct({ _tag: Schema.tag("A"), value: Schema.Number })
// _tag is optional in make, auto-filled to "A"
const a = A.make({ value: 42 })
// a: { _tag: "A", value: 42 }
tag("QuitError")
}) {
/**
* Marks this value as a terminal quit error for runtime guards.
*
* @since 4.0.0
*/
readonly [const QuitErrorTypeId: "effect/platform/Terminal/QuitError"QuitErrorTypeId] = const QuitErrorTypeId: "effect/platform/Terminal/QuitError"QuitErrorTypeId
}