OxL Reference

data ProtocolError

Everything else that can go wrong on the wire (§6.5, §10.1): msg has the text, code the gRPC status (std.rpc.Status numbering, 2 = UNKNOWN). The constants are matched like variants (ProtocolError.Internal =>, D-2901).

Example:

oxl✓ checked in CI
fn main() io {
  let e: NetError = ProtocolError.InvalidArgument
  match e {
    ProtocolError.InvalidArgument => print("bad request")
    ProtocolError p => print("{p.code}")
    _ => print("other")
  }
}
Output
bad request
@error pub(api) data ProtocolError

Since. 1.0.0-beta

Fields

pub(api) msg: str = ""

The text of the error.

pub(api) code: i32 = 2

The gRPC status code (2 = UNKNOWN).

Defined in: std/core/types.oxl:1363

See also