Skip to content

Marshal and unmarshal @ocap/errors #150

@rekmarks

Description

@rekmarks

Following #149, we should modify the marshaling functions in @ocap/streams such that errors from @ocap/errors are unmarshaled into their respective classes, based on the error code.

There's a question of how much runtime type validation we want to do here. It may be reasonable to pursue either of these paths:

  1. assume that an object that matches the basic error shape and has a recognized code can be instantiated as the appropriate error class.
  2. Add Superstruct guards for each custom error class and only instantiate them if the guards pass. Otherwise, just instantiate as a plain error, or throw because we've messed up (assuming we're only dealing with kernel and not user data).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions