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 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1x 1x 3x 1x 7x 7x 7x 7x 7x 1x | import type { Flattable, ITypeBuilder } from '@stevenkellner/typescript-common-functionality'; import type { FunctionsErrorCode as FirebaseFunctionsErrorCode } from 'firebase-functions/lib/common/providers/https'; export type FunctionsErrorCode = FirebaseFunctionsErrorCode; export namespace FunctionsErrorCode { export function isFunctionsErrorCode(code: string): code is FunctionsErrorCode { return [ 'ok', 'cancelled', 'unknown', 'invalid-argument', 'deadline-exceeded', 'not-found', 'already-exists', 'permission-denied', 'resource-exhausted', 'failed-precondition', 'aborted', 'out-of-range', 'unimplemented', 'internal', 'unavailable', 'data-loss', 'unauthenticated' ].includes(code); } } export class FunctionsError extends Error implements Flattable<FunctionsError.Flatten> { public readonly name = 'FunctionsError'; public constructor( public readonly code: FunctionsErrorCode, public readonly message: string, public readonly details: string | null = null ) { super(message); } public get flatten(): FunctionsError.Flatten { return { name: this.name, code: this.code, message: this.message, details: this.details }; } } // istanbul ignore next export namespace FunctionsError { export type Flatten = { name: 'FunctionsError'; code: FunctionsErrorCode; message: string; details: string | null; }; export class TypeBuilder implements ITypeBuilder<FunctionsError.Flatten, FunctionsError> { public build(flatten: FunctionsError.Flatten): FunctionsError { return new FunctionsError(flatten.code, flatten.message, flatten.details); } } export const builder = new TypeBuilder(); } |