diff --git a/CHANGELOG.md b/CHANGELOG.md index 83eb31356a..84993ce5e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## master + +Changes: + +- Remove extra error logging in internal rpc-core Observable + + ## 9.2.3 Aug 21, 2022 Contributed: diff --git a/packages/rpc-core/src/util/drr.ts b/packages/rpc-core/src/util/drr.ts index b4df7990ea..e70f4b30d4 100644 --- a/packages/rpc-core/src/util/drr.ts +++ b/packages/rpc-core/src/util/drr.ts @@ -5,7 +5,7 @@ import type { Observable } from 'rxjs'; import { catchError, distinctUntilChanged, publishReplay, refCount, tap } from 'rxjs'; -import { logger, stringify } from '@polkadot/util'; +import { stringify } from '@polkadot/util'; import { refCountDelay } from './refCountDelay'; @@ -17,18 +17,17 @@ interface Options { skipTimeout?: boolean; } -const l = logger('drr'); - -const CMP = (a: unknown, b: unknown): boolean => - stringify({ t: a }) === stringify({ t: b }); - -const ERR = (error: Error): Observable => { - l.error(error.message); +function CMP (a: unknown, b: unknown): boolean { + return stringify({ t: a }) === stringify({ t: b }); +} +function ERR (error: Error): Observable { throw error; -}; +} -const NOOP = (): void => undefined; +function NOOP (): void { + // empty +} /** * Shorthand for distinctUntilChanged(), publishReplay(1) and refCount(). @@ -36,14 +35,16 @@ const NOOP = (): void => undefined; * @ignore * @internal */ -export const drr = ({ delay, skipChange = false, skipTimeout = false }: Options = {}): DrrResult => (source$: Observable): Observable => - source$.pipe( - catchError(ERR), - skipChange - ? tap(NOOP) - : distinctUntilChanged(CMP), - publishReplay(1), - skipTimeout - ? refCount() - : refCountDelay(delay) - ); +export function drr ({ delay, skipChange = false, skipTimeout = false }: Options = {}): DrrResult { + return (source$: Observable): Observable => + source$.pipe( + catchError(ERR), + skipChange + ? tap(NOOP) + : distinctUntilChanged(CMP), + publishReplay(1), + skipTimeout + ? refCount() + : refCountDelay(delay) + ); +}