import { HawkInitialSettings, JavaScriptCatcherIntegrations } from './types'; import { VueIntegration } from './integrations/vue'; import { BaseCatcher } from '@hawk.so/core'; /** * Hawk JavaScript browser catcher * Module for errors and exceptions tracking * * @copyright CodeX */ export default class Catcher extends BaseCatcher { /** * JS Catcher version */ readonly version: string; /** * Vue.js integration instance */ vue: VueIntegration | null; /** * Catcher Type */ private static readonly type; /** * Enable debug mode */ private readonly debug; /** * Disable Vue.js error handler */ private readonly disableVueErrorHandler; /** * Console log handler */ private readonly consoleTracking; /** * Console catcher instance */ private readonly consoleCatcher; /** * Issues monitor instance */ private issuesMonitor; /** * Catcher constructor * * @param {HawkInitialSettings|string} settings - If settings is a string, it means an Integration Token */ constructor(settings: HawkInitialSettings | string); /** * Method for Frameworks SDK using own error handlers. * Allows to send errors to Hawk with additional Frameworks data (addons) * * @param error - error to send * @param addons - framework-specific data, can be undefined */ captureError(error: Error | string, addons?: JavaScriptCatcherIntegrations): void; /** * Add error handing to the passed Vue app * * @param vue - Vue app */ connectVue(vue: any): void; /** * Returns {@link Catcher.type} */ protected getCatcherType(): typeof Catcher.type; /** * Returns catcher version */ protected getCatcherVersion(): string; /** * Configure issues-related features: * - global errors handling * - performance issue detectors (Long Tasks / LoAF) * * @param settings */ private configureIssues; /** * Init global errors handler */ private initGlobalHandlers; /** * Handles the event and sends it to the server * * @param {ErrorEvent|PromiseRejectionEvent} event — (!) both for Error and Promise Rejection */ private handleEvent; }