ExceptionResolverManager class final
Central registry and lifecycle coordinator for all ExceptionResolver instances in the Jetleaf web framework.
The ExceptionResolverManager is responsible for discovering, ordering,
and managing all exception resolvers that handle errors during the HTTP
request–response lifecycle.
Each ExceptionResolver knows how to process a specific type of exception
and convert it into an appropriate HttpResponse.
Responsibilities
- Scans the
ApplicationContextfor registered ExceptionResolver Pods. - Allows WebConfigurer implementations to contribute custom resolvers.
- Maintains a globally ordered chain of resolvers for exception handling.
- Ensures deterministic and predictable resolution order.
Initialization Flow
- During application startup, onReady is invoked automatically.
- The manager queries the
ApplicationContextfor all ExceptionResolver Pods. - Custom resolvers are added via WebConfigurer.addExceptionResolvers.
- Resolvers are ordered using
AnnotationAwareOrderComparator.
Exception Handling Strategy
When an exception is thrown during request processing:
- The dispatcher retrieves the ordered list of resolvers.
- Each resolver is invoked sequentially until one successfully handles the exception.
- The first resolver that returns
trueshort-circuits further processing. - If no resolver handles the exception, the framework’s fallback error handler is used.
Example
final manager = ExceptionResolverManager();
manager.setApplicationContext(context);
await manager.onReady();
final resolvers = manager.getExceptionResolvers();
for (final resolver in resolvers) {
print('Loaded resolver: ${resolver.runtimeType}');
}
Common Resolver Types
- ControllerAdviceExceptionResolver — Handles exceptions from annotated controllers
- ResponseStatusExceptionResolver — Maps exceptions to HTTP statuses
- DefaultExceptionResolver — Provides default framework error handling
- CustomBusinessExceptionResolver — Handles domain-specific exceptions
See also
- ExceptionResolver
- WebConfigurer
ApplicationContextAnnotationAwareOrderComparator
Constructors
- ExceptionResolverManager(ContentNegotiationResolver _negotiationResolver)
- Central registry and lifecycle coordinator for all ExceptionResolver instances in the Jetleaf web framework.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getPackageName(
) → String - Represents an abstraction for identifying the package that an object, resource, or service belongs to.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onReady(
) → Future< void> - Interface to be implemented by pods that require initialization logic after their properties have been set by the container.
-
resolve(
ServerHttpRequest request, ServerHttpResponse response, HandlerMethod? method, Object ex, StackTrace st) → Future< bool> - Attempts to resolve an exception using the configured exception resolvers.
-
setApplicationContext(
ApplicationContext applicationContext) → void -
Sets the
ApplicationContextthat this component runs in. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited