Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1x 19x 16x 3x 2x 1x 1x | import { FirebaseError } from '@angular/fire/app'; /** * TypeScript/linters want caught errors to be of type unknown. So this function handles checking * for FirebaseError and extracting the code, or the message from plain Errors. */ export const getErrorCode = (err: unknown): string => { if (err instanceof FirebaseError) { return err.code; } if (err instanceof Error) { return err.message; } console.error('Unknown Error', err); return 'unknown'; }; |