/** * @description 表示异常来源所属的运行时类型。 */ export type ExceptionRuntime = "browser" | "nodejs" | "unknown" /** * @description 表示取消异常监听的清理函数。 */ export type ExceptionListenerCleanup = () => void /** * @description 表示一条标准化异常记录中的共享字段。 */ export interface ExceptionRecord { runtime: ExceptionRuntime source: string exception: unknown message?: string | undefined timestamp: number originalEvent?: unknown | undefined } /** * @description 表示标准化异常记录时所需的共享输入。 */ export interface ExceptionRecordInput { runtime: ExceptionRuntime source: string exception: unknown message?: string | undefined timestamp?: number | undefined originalEvent?: unknown | undefined } /** * @description 表示浏览器侧全局异常来源。 */ export type BrowserExceptionSource = | "browser.global-error" | "browser.window-onerror" | "browser.unhandled-rejection" /** * @description 表示浏览器侧标准化异常记录。 */ export interface BrowserExceptionRecord extends ExceptionRecord { runtime: "browser" source: BrowserExceptionSource filename?: string | undefined lineno?: number | undefined colno?: number | undefined } /** * @description 表示标准化浏览器异常记录时所需的输入。 */ export interface BrowserExceptionRecordInput extends Omit< ExceptionRecordInput, "runtime" | "source" > { source: BrowserExceptionSource filename?: string | undefined lineno?: number | undefined colno?: number | undefined } /** * @description 表示 Nodejs 侧全局异常来源。 */ export type NodejsExceptionSource = | "nodejs.uncaught-exception-monitor" | "nodejs.uncaught-exception" | "nodejs.unhandled-rejection" /** * @description 表示 Nodejs 侧标准化异常记录。 */ export interface NodejsExceptionRecord extends ExceptionRecord { runtime: "nodejs" source: NodejsExceptionSource origin?: string | undefined promise?: Promise | undefined } /** * @description 表示标准化 Nodejs 异常记录时所需的输入。 */ export interface NodejsExceptionRecordInput extends Omit< ExceptionRecordInput, "runtime" | "source" > { source: NodejsExceptionSource origin?: string | undefined promise?: Promise | undefined } /** * @description 表示批量安装异常监听器时可选的通用配置。 */ export interface ObserveExceptionsOptions { captureTimestamp?: (() => number) | undefined }