Skip to content
Playground(another site)

bynk.http.error_status_position

Error An ErrorStatus name is used anywhere but as RawError's first argument.

An ErrorStatus name such as Forbidden stands for a status only as RawError's first argument, where the compiler turns it into the number it answers. It is not a type, so a status can't be stored or passed to a helper. Name the status where the response is built, and let a helper build the body.

Example

let status = ErrorStatus.Forbidden // ✗ a status has no value here
fn problem(msg: String) -> Bytes { Bytes.fromUtf8(msg) }
RawError(Forbidden, problem("no access"), "text/plain") // ✓

In the Book

See also

  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.error_status_position shows the same from the installed toolchain, without a network.