use of io.micronaut.web.router.exceptions.RoutingException in project micronaut-core by micronaut-projects.
the class DefaultRouteBuilder method buildRoute.
/**
* Build a route.
*
* @param httpMethod The HTTP method
* @param uri The URI
* @param type The type
* @param method The method
* @param parameterTypes Parameters
*
* @return an {@link UriRoute}
*/
protected UriRoute buildRoute(HttpMethod httpMethod, String uri, Class<?> type, String method, Class... parameterTypes) {
Optional<? extends MethodExecutionHandle<?, Object>> executionHandle = executionHandleLocator.findExecutionHandle(type, method, parameterTypes);
MethodExecutionHandle<?, Object> executableHandle = executionHandle.orElseThrow(() -> new RoutingException("No such route: " + type.getName() + "." + method));
return buildRoute(httpMethod, uri, executableHandle);
}
use of io.micronaut.web.router.exceptions.RoutingException in project micronaut-core by micronaut-projects.
the class DefaultRouteBuilder method error.
@Override
public ErrorRoute error(Class originatingClass, Class<? extends Throwable> error, Class type, String method, Class[] parameterTypes) {
Optional<MethodExecutionHandle<?, Object>> executionHandle = executionHandleLocator.findExecutionHandle(type, method, parameterTypes);
MethodExecutionHandle<?, Object> executableHandle = executionHandle.orElseThrow(() -> new RoutingException("No such route: " + type.getName() + "." + method));
DefaultErrorRoute errorRoute = new DefaultErrorRoute(originatingClass, error, executableHandle, conversionService);
this.errorRoutes.add(errorRoute);
return errorRoute;
}
use of io.micronaut.web.router.exceptions.RoutingException in project micronaut-core by micronaut-projects.
the class DefaultRouteBuilder method status.
@Override
public StatusRoute status(Class originatingClass, HttpStatus status, Class type, String method, Class[] parameterTypes) {
Optional<MethodExecutionHandle<?, Object>> executionHandle = executionHandleLocator.findExecutionHandle(type, method, parameterTypes);
MethodExecutionHandle<?, Object> executableHandle = executionHandle.orElseThrow(() -> new RoutingException("No such route: " + type.getName() + "." + method));
DefaultStatusRoute statusRoute = new DefaultStatusRoute(originatingClass, status, executableHandle, conversionService);
this.statusRoutes.add(statusRoute);
return statusRoute;
}
Aggregations