Package io.micronaut.web.router
Interface ErrorRoute
-
- All Superinterfaces:
MethodBasedRoute,Route
public interface ErrorRoute extends MethodBasedRoute
Represents aRoutethat matches an exception.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.web.router.Route
DEFAULT_PRODUCES
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ErrorRouteconsumes(io.micronaut.http.MediaType... mediaType)Applies the given accepted media type the route.java.lang.Class<? extends java.lang.Throwable>exceptionType()<T> java.util.Optional<RouteMatch<T>>match(java.lang.Class originatingClass, java.lang.Throwable exception)Match the given exception.<T> java.util.Optional<RouteMatch<T>>match(java.lang.Throwable exception)Match the given exception.ErrorRoutenest(java.lang.Runnable nested)Defines routes nested within this route.java.lang.Class<?>originatingType()ErrorRouteproduces(io.micronaut.http.MediaType... mediaType)Applies the given accepted media type the route.ErrorRoutewhere(java.util.function.Predicate<io.micronaut.http.HttpRequest<?>> condition)Match thisRouteonly if the given predicate is true.-
Methods inherited from interface io.micronaut.web.router.MethodBasedRoute
getTargetMethod
-
Methods inherited from interface io.micronaut.web.router.Route
body, body, consumesAll, getConsumes, getProduces
-
-
-
-
Method Detail
-
originatingType
java.lang.Class<?> originatingType()
- Returns:
- The type the exception originates from. Null if the error route is global.
-
exceptionType
java.lang.Class<? extends java.lang.Throwable> exceptionType()
- Returns:
- The type of exception
-
match
<T> java.util.Optional<RouteMatch<T>> match(java.lang.Throwable exception)
Match the given exception.- Type Parameters:
T- The type- Parameters:
exception- The exception to match- Returns:
- The route match
-
match
<T> java.util.Optional<RouteMatch<T>> match(java.lang.Class originatingClass, java.lang.Throwable exception)
Match the given exception.- Type Parameters:
T- The type- Parameters:
originatingClass- The class where the error originates fromexception- The exception to match- Returns:
- The route match
-
consumes
ErrorRoute consumes(io.micronaut.http.MediaType... mediaType)
Description copied from interface:RouteApplies the given accepted media type the route.
-
nest
ErrorRoute nest(java.lang.Runnable nested)
Description copied from interface:RouteDefines routes nested within this route.
-
where
ErrorRoute where(java.util.function.Predicate<io.micronaut.http.HttpRequest<?>> condition)
Description copied from interface:RouteMatch thisRouteonly if the given predicate is true.
-
produces
ErrorRoute produces(io.micronaut.http.MediaType... mediaType)
Description copied from interface:RouteApplies the given accepted media type the route.
-
-