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

enum EncodeError

Why a value could not be encoded (std.ser re-exports it; §9, D-2115).

Example:

oxl✓ проверяется в CI
fn describe(e: EncodeError) -> str {
  match e {
    EncodeError.Secret _ => "a secret field cannot go to JSON"
    EncodeError.Unsupported _ => "the format cannot represent the value"
    EncodeError.Failed _ => "a codec failed"
  }
}

fn main() io {
  print(describe(EncodeError.Unsupported(msg: "cbor")))
}
Вывод
the format cannot represent the value
@error pub(api) enum EncodeError

С версии. 1.0.0-beta

Варианты

Secret(msg: str)

A secret<T> field reached the JSON encoder (§9.3).

Unsupported(msg: str)

The format cannot represent the value (ActorRef on a single node, MessagePack, CBOR).

Failed(msg: str)

A user codec returned an error.

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

См. также