UNPKG

@versatiledatakit/shared

Version:

Versatile Data Kit Shared library enables reusability of shared features like: NgRx Redux, Error Handlers, Utils, Generic Components, etc.

61 lines (60 loc) 2.58 kB
import { OnDestroy } from '@angular/core'; import { ErrorStore, ServiceHttpErrorCodes, TaurusObject } from '../../../../common'; import * as i0 from "@angular/core"; /** * ** Taurus base component with provided in some way auto handling for errors. * * - This component is mutually exclusive with TaurusBaseComponent. * - In this component error handling like error recording, error filter, search, etc.. is handled into the Component itself, * while in TaurusBaseComponent it's handled in the upper level inside the Effects and provided through ComponentModel to the Component itself. */ export declare class TaurusErrorBaseComponent extends TaurusObject implements OnDestroy { /** * @inheritDoc */ static readonly CLASS_NAME: string; /** * @inheritDoc */ static readonly PUBLIC_NAME: string; /** * ** Reference to local ErrorStore. */ errors: ErrorStore; /** * ** Error codes supported in class and its corresponding subclasses. */ errorCodes: Readonly<Record<string, string>>; /** * ** Constructor. */ constructor(className?: string); /** * @inheritDoc */ ngOnDestroy(): void; /** * ** Generates Error code (token). * * - Code (token) should start with Class name, * then followed by underscore and class PUBLIC_NAME, * then followed by underscore and method name or underscore with some error specifics, * and followed by underscore and additional details to avoid overlaps with other Class errors. * * <br/> * <i>returned value pattern</i>: * <p> * <Class Name><b>_</b><Class PUBLIC_NAME><b>_</b><Class method name><b>_</b><additional details, like HTTP Status Code> * </p> */ protected generateErrorCode(className: string, classPublicName: string, methodName: string, additionalDetails?: string): string; /** * ** Process service HTTP request error and return ErrorRecord. * * @param {Record<keyof ServiceHttpErrorCodes, string>} serviceHttpErrorCodes - is map of Service method supported error codes auto-handling * @param {unknown} error - is actual error object reference */ protected processServiceRequestError(serviceHttpErrorCodes: Record<keyof ServiceHttpErrorCodes, string>, error: unknown): void; static ɵfac: i0.ɵɵFactoryDeclaration<TaurusErrorBaseComponent, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<TaurusErrorBaseComponent, never, never, {}, {}, never>; }