Documentation / @etherfold/browser / PortError
Type Alias: PortError ​
PortError =
object
Defined in: packages/browser/src/host/errors.ts:28
A FAILURE, as it crosses a port.
An Error does not survive postMessage as itself in any useful sense -- the class is gone on the other side even where the browser clones the object -- so a failure crosses as DATA and is rebuilt as an Error on arrival. What is kept is what a caller can act on: the name (which is the class's own name, and is therefore what a refusal is narrowed on), the message, and the refusal's own fields (below).
The stack is the HOST's, carried deliberately: a failure that happened inside a worker and is reported in a tab has no stack a tab's debugger can show, and the first thing anybody asks of a cross-boundary failure is where it came from.
A REFUSAL KEEPS ITS OWN FIELDS ​
The refusals this port carries are not prose with a name on top: a GenerationCapReachedError says WHICH cap, at WHAT limit, for WHICH generation, and lists the generations and streams that could be deleted to make room. An app acts on those, and a crossing that kept only the sentence would leave it parsing one. So details carries the refusal's OWN enumerable fields and errorFromPort puts them back where the class declared them -- the failure a tab catches has the shape the host's class has, minus the prototype no copy can carry.
Properties ​
details? ​
readonlyoptionaldetails?:Readonly<Record<string,unknown>>
Defined in: packages/browser/src/host/errors.ts:41
The refusal's OWN fields, where it declares any: the data an app branches on.
Absent where the failure carries nothing beside its message, which is most of them. A field that cannot cross (a function, a class instance -- a refusal naming the STORE it was refused by, say) is DROPPED rather than taking the whole refusal down with it: the message and the name always get through, and they are what makes it catchable at all.
message ​
readonlymessage:string
Defined in: packages/browser/src/host/errors.ts:30
name ​
readonlyname:string
Defined in: packages/browser/src/host/errors.ts:29
stack? ​
readonlyoptionalstack?:string
Defined in: packages/browser/src/host/errors.ts:31