You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/event-handler/src/rest/ErrorHandlerRegistry.ts
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -71,4 +71,21 @@ export class ErrorHandlerRegistry {
71
71
72
72
returnnull;
73
73
}
74
+
75
+
/**
76
+
* Merges another {@link ErrorHandlerRegistry | `ErrorHandlerRegistry`} instance into the current instance.
77
+
* It takes the handlers from the provided registry and adds them to the current registry.
78
+
*
79
+
* Error handlers from the included router are merged with existing handlers. If handlers for the same error type exist in both routers, the included router's handler takes precedence.
80
+
*
81
+
* @param errorHandlerRegistry - The registry instance to merge with the current instance
* Merges another {@link RouteHandlerRegistry | `RouteHandlerRegistry`} instance into the current instance.
203
+
* It takes the static and dynamic routes from the provided registry and adds them to the current registry.
204
+
*
205
+
* Routes from the included router are added to the current router's registry. If a route with the same method and path already exists, the included router's route takes precedence.
206
+
*
207
+
* @param routeHandlerRegistry - The registry instance to merge with the current instance
208
+
* @param options - Configuration options for merging the router
209
+
* @param options.prefix - An optional prefix to be added to the paths defined in the router
* Merges the routes, context and middleware from the passed router instance into this router instance.
555
+
*
556
+
* **Override Behaviors:**
557
+
* - **Context**: Properties from the included router override existing properties with the same key in the current router. A warning is logged when conflicts occur.
558
+
* - **Routes**: Routes from the included router are added to the current router's registry. If a route with the same method and path already exists, the included router's route takes precedence.
559
+
* - **Error Handlers**: Error handlers from the included router are merged with existing handlers. If handlers for the same error type exist in both routers, the included router's handler takes precedence.
560
+
* - **Middleware**: Middleware from the included router is appended to the current router's middleware array. All middleware executes in registration order (current router's middleware first, then included router's middleware).
561
+
*
562
+
* @example
563
+
* ```typescript
564
+
* import { Router } from '@aws-lambda-powertools/event-handler/experimental-rest';
0 commit comments