bynk.types.err_value_mismatch
Error An Err payload has the wrong type.
Err(e) takes its error type from the surrounding Result[T, E], the annotation or the function's return type, so Err(404) where E is String is refused at the value, with no conversion. Pass an E, or change the declared error type. The success half is bynk.types.ok_value_mismatch; with nothing to fix the Result, it is bynk.types.cannot_infer_result_type_params.
Example
fn total() -> Result[Int, String] { Err(404) // ✗ an `Int`, where the error type is `String`}
fn total() -> Result[Int, String] { Err("not found") // ✓}In the Book
See also
- The grammar rule it governs:
err_expr. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.err_value_mismatchshows the same from the installed toolchain, without a network.