Skip to content
Playground(another site)

bynk.http.duplicate_rejected

Error A from http service declares on rejected more than once.

on rejected renders every refusal the router makes for a service's routes, so a service has one and it must handle every case: a second would leave the router choosing between them. Merge the two into one that matches on why. Its required shape is bynk.http.rejected_signature.

Example

on rejected(why: BoundaryRejection) -> Effect[HttpResult[()]] { … }
on rejected(why: BoundaryRejection) -> Effect[HttpResult[()]] { … } // ✗ already declared above
on rejected(why: BoundaryRejection) -> Effect[HttpResult[()]] {
match why {
MethodNotAllowed => RawError(MethodNotAllowed, Bytes.empty(), "text/plain") // ✓ one hook, all cases
_ => RawError(BadRequest, Bytes.empty(), "text/plain")
}
}

In the Book

See also

  • The grammar rule it governs: rejected_handler.
  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.duplicate_rejected shows the same from the installed toolchain, without a network.