bynk.types.question_option_outside_http
Error ? lifts an Option only inside a handler returning HttpResult (None becomes NotFound); elsewhere use .okOr(err).
? on an Option turns None into an early return, which needs somewhere to return it to. In a handler that returns an HttpResult, None becomes a NotFound response. Elsewhere an Option has no error to carry, so ? is refused. Say what absence means with .okOr(err), which makes a Result, and put ? after that.
Example
fn lookup(id: Int) -> Option[Int] { … }
fn double(id: Int) -> Result[Int, String] { let n = lookup(id)? // ✗ no `HttpResult` to answer `NotFound` Ok(n * 2)}
fn double(id: Int) -> Result[Int, String] { let n = lookup(id).okOr("missing")? // ✓ `None` becomes an `Err` Ok(n * 2)}In the Book
See also
- The grammar rule it governs:
question_expr. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.question_option_outside_httpshows the same from the installed toolchain, without a network.