(options: {
readonly _tag: SystemErrorTag
readonly module: string
readonly method: string
readonly description?: string | undefined
readonly syscall?: string | undefined
readonly pathOrDescriptor?: string | number | undefined
readonly cause?: unknown
}): PlatformErrorCreates a PlatformError whose reason is a SystemError.
When to use
Use to adapt an operating-system or platform failure into the normalized platform error model.
export const const systemError: (options: {
readonly _tag: SystemErrorTag
readonly module: string
readonly method: string
readonly description?: string | undefined
readonly syscall?: string | undefined
readonly pathOrDescriptor?:
| string
| number
| undefined
readonly cause?: unknown
}) => PlatformError
Creates a PlatformError whose reason is a SystemError.
When to use
Use to adapt an operating-system or platform failure into the normalized
platform error model.
systemError = (options: {
readonly _tag: SystemErrorTag
readonly module: string
readonly method: string
readonly description?: string | undefined
readonly syscall?: string | undefined
readonly pathOrDescriptor?:
| string
| number
| undefined
readonly cause?: unknown
}
options: {
readonly _tag: SystemErrorTag_tag: type SystemErrorTag =
| "AlreadyExists"
| "BadResource"
| "Busy"
| "InvalidData"
| "NotFound"
| "PermissionDenied"
| "TimedOut"
| "UnexpectedEof"
| "Unknown"
| "WouldBlock"
| "WriteZero"
Normalized category for failures reported by platform or system operations.
When to use
Use to type or match the normalized _tag on SystemError values reported
by platform operations.
Details
The tags group lower-level platform errors into a stable set such as
NotFound, PermissionDenied, TimedOut, and Unknown.
SystemErrorTag
readonly module: stringmodule: string
readonly method: stringmethod: string
readonly description?: string | undefineddescription?: string | undefined
readonly syscall?: string | undefinedsyscall?: string | undefined
readonly pathOrDescriptor?: string | number | undefinedpathOrDescriptor?: string | number | undefined
readonly cause?: unknowncause?: unknown
}): class PlatformErrorclass PlatformError {
message: string;
name: 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;
_tag: Tag;
reason: BadArgument | SystemError;
}
Tagged error used by platform APIs to report either invalid arguments or
system-level failures.
When to use
Use as the shared error type for platform APIs that expose invalid arguments
and host or operating-system failures through a single Effect error
channel.
Details
The reason field contains the underlying BadArgument or SystemError.
When that reason has a cause, the cause is preserved on the wrapper.
PlatformError => new constructor PlatformError(reason: BadArgument | SystemError): PlatformErrorTagged error used by platform APIs to report either invalid arguments or
system-level failures.
When to use
Use as the shared error type for platform APIs that expose invalid arguments
and host or operating-system failures through a single Effect error
channel.
Details
The reason field contains the underlying BadArgument or SystemError.
When that reason has a cause, the cause is preserved on the wrapper.
PlatformError(new constructor SystemError(): SystemErrorError data for a platform or system operation failure.
When to use
Use when you need normalized reason data for a platform or system operation
failure, including the operation details.
Details
The error records a normalized _tag, the module and method that failed,
and optional details such as the syscall, path or descriptor, description,
and original cause. It is usually wrapped in PlatformError.
SystemError(options: {
readonly _tag: SystemErrorTag
readonly module: string
readonly method: string
readonly description?: string | undefined
readonly syscall?: string | undefined
readonly pathOrDescriptor?:
| string
| number
| undefined
readonly cause?: unknown
}
options))