imp(core): #httpListener - error$
MODIFY
packages/core/src/http.listener.spec.ts
packages/core/src/http.listener.spec.ts
@@ -78,7 +78,7 @@ describe('Http listener', () => {
const error = new Error('test');
const req = {} as IncomingMessage;
const res = {} as OutgoingMessage;
- const errorEffect$ = jest.fn(() => of({ body: 'error' }));
+ const error$ = jest.fn(() => of({ body: 'error' }));
// when
effectsCombiner.combineMiddlewares = jest.fn(() => () => of(req));
@@ -91,13 +91,13 @@ describe('Http listener', () => {
httpListener({
middlewares: [middleware$],
effects: [effect$],
- errorEffect: errorEffect$,
+ error$,
})(req, res);
// then
setTimeout(() => {
expect(responseHandler.handleResponse).toHaveBeenCalledTimes(1);
- expect(errorEffect$).toHaveBeenCalled();
+ expect(error$).toHaveBeenCalled();
done();
}, 0);
});

MODIFY
packages/core/src/http.listener.ts
packages/core/src/http.listener.ts
@@ -14,13 +14,13 @@ import { createStaticInjectionContainer } from './server/server.injector';
export interface HttpListenerConfig {
middlewares?: Middleware[];
effects: (RouteEffect | RouteEffectGroup)[];
- errorEffect?: ErrorEffect;
+ error$?: ErrorEffect;
}
export const httpListener = ({
middlewares = [],
effects,
- errorEffect = defaultError$,
+ error$ = defaultError$,
}: HttpListenerConfig) => {
const requestSubject$ = new Subject<Http>();
const combinedMiddlewares = combineMiddlewares(...middlewares);
@@ -38,7 +38,7 @@ export const httpListener = ({
defaultIfEmpty(defaultResponse),
tap(res.send),
catchError(error =>
- errorEffect(of(req), res, error).pipe(
+ error$(of(req), res, error).pipe(
tap(res.send),
),
),

imp(core): #httpListener - error$