OxL Справочник OxL
РусскийEnglish

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✓ проверяется в CI
fn main() io {
  let e: NetError = ProtocolError.InvalidArgument
  match e {
    ProtocolError.InvalidArgument => print("bad request")
    ProtocolError p => print("{p.code}")
    _ => print("other")
  }
}
Вывод
bad request
@error pub(api) data ProtocolError

С версии. 1.0.0-beta

Поля

pub(api) msg: str = ""

The text of the error.

pub(api) code: i32 = 2

The gRPC status code (2 = UNKNOWN).

Определено в: std/core/types.oxl:1363

См. также