diff options
author | crupest <crupest@outlook.com> | 2020-08-24 22:59:45 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-08-24 22:59:45 +0800 |
commit | de1d582bf2ed7062fd400459f30d463d47ef9982 (patch) | |
tree | 777e27f954c9fd7beab36aad61bb767a28d65a89 /Timeline/ClientApp/src/app/utilities/rxjs.ts | |
parent | 5a8fb35c2791a921d8833beb37aa2edd5047da4c (diff) | |
download | timeline-de1d582bf2ed7062fd400459f30d463d47ef9982.tar.gz timeline-de1d582bf2ed7062fd400459f30d463d47ef9982.tar.bz2 timeline-de1d582bf2ed7062fd400459f30d463d47ef9982.zip |
...
Diffstat (limited to 'Timeline/ClientApp/src/app/utilities/rxjs.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/utilities/rxjs.ts | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Timeline/ClientApp/src/app/utilities/rxjs.ts b/Timeline/ClientApp/src/app/utilities/rxjs.ts index 1be49164..0730b899 100644 --- a/Timeline/ClientApp/src/app/utilities/rxjs.ts +++ b/Timeline/ClientApp/src/app/utilities/rxjs.ts @@ -1,14 +1,14 @@ -import { OperatorFunction } from 'rxjs';
-import { catchError } from 'rxjs/operators';
-
-export function convertError<T, NewError>(
- oldErrorType: { new (...args: never[]): unknown },
- newErrorType: { new (): NewError }
-): OperatorFunction<T, T> {
- return catchError((error) => {
- if (error instanceof oldErrorType) {
- throw new newErrorType();
- }
- throw error;
- });
-}
+import { OperatorFunction } from "rxjs"; +import { catchError } from "rxjs/operators"; + +export function convertError<T, NewError>( + oldErrorType: { new (...args: never[]): unknown }, + newErrorType: { new (): NewError } +): OperatorFunction<T, T> { + return catchError((error) => { + if (error instanceof oldErrorType) { + throw new newErrorType(); + } + throw error; + }); +} |