Skip to content

Commit

Permalink
chore: reuse existing error
Browse files Browse the repository at this point in the history
Let remove duplicates in the code base !
  • Loading branch information
JeanMeche committed Jan 1, 2024
1 parent 6c2c59f commit 96ab74b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/rxjs/src/internal/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
ErrorNotification,
NextNotification,
} from './types.js';
import { createInvalidObservableTypeError } from './util/throwUnobservableError.js';

/**
* An error thrown when one or more errors have occurred during the
Expand Down Expand Up @@ -1259,11 +1260,7 @@ export function getObservableInputType(input: unknown): ObservableInputType {
if (isReadableStreamLike(input)) {
return ObservableInputType.ReadableStreamLike;
}
throw new TypeError(
`You provided ${
input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`
} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`
);
throw createInvalidObservableTypeError(input);
}

/**
Expand Down

0 comments on commit 96ab74b

Please sign in to comment.