ws only speaks local WebSocket. The Node (or Tag-bound Node) was IpcSocket / Http (or a non-loopback URL) — use unix / http, or wsServer for custom binds.
errorswsunixhttpwsServer
Source src/internal/nodeCore.ts:100111 lines
export class class WsListenRequiresWsclass WsListenRequiresWs {
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;
node: string;
kind: string;
}
ws
only speaks local WebSocket. The Node (or Tag-bound Node) was IpcSocket / Http
(or a non-loopback URL) — use
unix
/
http
, or
wsServer
for custom binds.
WsListenRequiresWs extends import DataData.const TaggedError: <"WsListenRequiresWs">(tag: "WsListenRequiresWs") => new <A>(args: VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
readonly _tag: "WsListenRequiresWs";
} & Readonly<A>
Creates a tagged error class with a _tag discriminator.
When to use
Use when you need domain errors with discriminated-union handling.
Details
Like
Error
, but instances also carry a readonly _tag property,
enabling Effect.catchTag and Effect.catchTags for tag-based recovery.
The _tag is excluded from the constructor argument. Yielding an instance
inside Effect.gen fails the effect with this error.
Example (Recovering by tag)
import { Data, Effect } from "effect"
class NotFound extends Data.TaggedError("NotFound")<{
readonly resource: string
}> {}
class Forbidden extends Data.TaggedError("Forbidden")<{
readonly reason: string
}> {}
const program = Effect.gen(function*() {
return yield* new NotFound({ resource: "/users/42" })
})
const recovered = program.pipe(
Effect.catchTag("NotFound", (e) =>
Effect.succeed(`missing: ${e.resource}`))
)
TaggedError("WsListenRequiresWs")<{
readonly node: stringnode: string;
readonly kind: stringkind: string;
}> {
override get WsListenRequiresWs.message: stringmessage() {
return (
`Node.ws requires a local WebSocket Node (loopback ws:// url or address-less mint); ` +
`"${this.node: stringnode}" is ${this.kind: stringkind}. Use Node.unix / Node.http (or ipcServer / httpServer) for other transports.`
);
}
}
Referenced by 1 symbols