Route

zio.http.Route
See theRoute companion object
sealed trait Route[-Env, +Err]

Attributes

Companion
object
Source
Route.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Route[Env, Err]

Members list

Value members

Abstract methods

The location where the route was created, which is useful for debugging purposes.

The location where the route was created, which is useful for debugging purposes.

Attributes

Source
Route.scala

The route pattern over which the route is defined. The route can only handle requests that match this route pattern.

The route pattern over which the route is defined. The route can only handle requests that match this route pattern.

Attributes

Source
Route.scala
def toHandler(implicit ev: Err <:< Response, trace: Trace): Handler[Env, Response, Request, Response]

Attributes

Source
Route.scala

Concrete methods

final def apply(request: Request)(implicit ev: Err <:< Response, trace: Trace): ZIO[Scope & Env, Response, Response]

Applies the route to the specified request. The route must be defined for the request, or else this method will fail fatally. Note that you may only call this function when you have handled all errors produced by the route, converting them into responses.

Applies the route to the specified request. The route must be defined for the request, or else this method will fail fatally. Note that you may only call this function when you have handled all errors produced by the route, converting them into responses.

Attributes

Source
Route.scala
def asErrorType[Err2](implicit ev: Err <:< Err2): Route[Env, Err2]

Attributes

Source
Route.scala
final def handleError(f: Err => Response)(implicit trace: Trace): Route[Env, Nothing]

Handles all typed errors in the route by converting them into responses. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles all typed errors in the route by converting them into responses. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

If the underlying handler uses the error channel to send responses, this method will not pass the responses to the provided function.

Attributes

Source
Route.scala
final def handleErrorCause(f: (Cause[Err]) => Response)(implicit trace: Trace): Route[Env, Nothing]

Handles all typed errors, as well as all non-recoverable errors, by converting them into responses. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles all typed errors, as well as all non-recoverable errors, by converting them into responses. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

If the underlying handler uses the error channel to send responses, this method will not pass the responses to the provided function.

Attributes

Source
Route.scala
final def handleErrorCauseZIO[Env1 <: Env](f: (Cause[Err]) => ZIO[Env1, Nothing, Response])(implicit trace: Trace): Route[Env1, Nothing]

Handles all typed errors, as well as all non-recoverable errors, by converting them into a ZIO effect that produces the response. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles all typed errors, as well as all non-recoverable errors, by converting them into a ZIO effect that produces the response. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

If the underlying handler uses the error channel to send responses, this method will not pass the responses to the provided function.

Attributes

Source
Route.scala
final def handleErrorRequest(f: (Err, Request) => Response)(implicit trace: Trace): Route[Env, Nothing]

Handles all typed errors in the route by converting them into responses, taking into account the request that caused the error. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles all typed errors in the route by converting them into responses, taking into account the request that caused the error. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

If the underlying handler uses the error channel to send responses, this method will not pass the responses to the provided function.

Attributes

Source
Route.scala
final def handleErrorRequestCause(f: (Request, Cause[Err]) => Response)(implicit trace: Trace): Route[Env, Nothing]

Handles all typed errors, as well as all non-recoverable errors, by converting them into responses, taking into account the request that caused the error. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles all typed errors, as well as all non-recoverable errors, by converting them into responses, taking into account the request that caused the error. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

If the underlying handler uses the error channel to send responses, this method will not pass the responses to the provided function.

Attributes

Source
Route.scala
final def handleErrorRequestCauseZIO[Env1 <: Env](f: (Request, Cause[Err]) => ZIO[Env1, Nothing, Response])(implicit trace: Trace): Route[Env1, Nothing]

Handles all typed errors, as well as all non-recoverable errors, by converting them into a ZIO effect that produces the response, taking into account the request that caused the error. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles all typed errors, as well as all non-recoverable errors, by converting them into a ZIO effect that produces the response, taking into account the request that caused the error. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

If the underlying handler uses the error channel to send responses, this method will not pass the responses to the provided function.

Attributes

Source
Route.scala
final def handleErrorRequestZIO[Env1 <: Env](f: (Err, Request) => ZIO[Env1, Nothing, Response])(implicit trace: Trace): Route[Env1, Nothing]

Handles all typed errors in the route by converting them into a ZIO effect that produces a response, taking into account the request that caused the error. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles all typed errors in the route by converting them into a ZIO effect that produces a response, taking into account the request that caused the error. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

If the underlying handler uses the error channel to send responses, this method will not pass the responses to the provided function.

Attributes

Source
Route.scala
final def handleErrorZIO[Env1 <: Env](f: Err => ZIO[Env1, Nothing, Response])(implicit trace: Trace): Route[Env1, Nothing]

Handles all typed errors in the route by converting them into a zio effect that produces a response. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles all typed errors in the route by converting them into a zio effect that produces a response. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

If the underlying handler uses the error channel to send responses, this method will not pass the responses to the provided function.

Attributes

Source
Route.scala
final def isDefinedAt(request: Request): Boolean

Determines if the route is defined for the specified request.

Determines if the route is defined for the specified request.

Attributes

Source
Route.scala
final def mapError[Err1](fxn: Err => Err1)(implicit trace: Trace): Route[Env, Err1]

Allows the transformation of the Err type through a function allowing one to build up a Routes in Stages targets the Unhandled case

Allows the transformation of the Err type through a function allowing one to build up a Routes in Stages targets the Unhandled case

Attributes

Source
Route.scala
final def mapErrorZIO[Err1](fxn: Err => ZIO[Any, Err1, Response])(implicit trace: Trace): Route[Env, Err1]

Allows the transformation of the Err type through an Effectful program allowing one to build up a Routes in Stages targets the Unhandled case only.

Allows the transformation of the Err type through an Effectful program allowing one to build up a Routes in Stages targets the Unhandled case only.

Attributes

Source
Route.scala
def nest(prefix: PathCodec[Unit]): Route[Env, Err]

Attributes

Source
Route.scala
final def provideEnvironment(env: ZEnvironment[Env]): Route[Any, Err]

Attributes

Source
Route.scala
final def run(request: Request)(implicit trace: Trace): ZIO[Scope & Env, Either[Err, Response], Response]

Applies the route to the specified request. The route must be defined for the request, or else this method will fail fatally.

Applies the route to the specified request. The route must be defined for the request, or else this method will fail fatally.

Attributes

Source
Route.scala
final def sandbox(implicit trace: Trace): Route[Env, Nothing]

Returns a route that automatically translates all failures into responses, using best-effort heuristics to determine the appropriate HTTP status code. Based on the currently configured ErrorResponseConfig, the response will have a body that may include a message and a stack trace.

Returns a route that automatically translates all failures into responses, using best-effort heuristics to determine the appropriate HTTP status code. Based on the currently configured ErrorResponseConfig, the response will have a body that may include a message and a stack trace.

Attributes

Source
Route.scala
final def tapErrorCauseZIO[Err1 >: Err](f: (Cause[Err]) => ZIO[Any, Err1, Any])(implicit trace: Trace, ev: CheckResponse[Err]): Route[Env, Err1]

Effectfully peeks at the unhandled failure cause of this Route.

Effectfully peeks at the unhandled failure cause of this Route.

Attributes

Source
Route.scala
final def tapErrorZIO[Err1 >: Err](f: Err => ZIO[Any, Err1, Any])(implicit trace: Trace, ev: CheckResponse[Err]): Route[Env, Err1]

Effectfully peeks at the unhandled failure of this Route.

Effectfully peeks at the unhandled failure of this Route.

Attributes

Source
Route.scala
final def toRoutes: Routes[Env, Err]

Attributes

Source
Route.scala
def transform[Env1](f: (Handler[Env, Response, Request, Response]) => Handler[Env1, Response, Request, Response]): Route[Env1, Err]

Attributes

Source
Route.scala