backtrace-js
Version:
Backtrace.io error reporting tool for client-side applications
97 lines (96 loc) • 3.23 kB
TypeScript
import { IBacktraceData } from '../model/backtraceData';
import { BacktraceStackTrace } from '../model/backtraceStackTrace';
import { IBreadcrumb } from './breadcrumbs';
/**
* BacktraceReport describe current exception/message payload message to Backtrace
*/
export declare class BacktraceReport {
private err;
private clientAttributes;
private breadcrumbs?;
private attachment?;
readonly uuid: string;
readonly timestamp: number;
readonly lang = "js";
readonly langVersion: string;
readonly agent = "backtrace-js";
readonly agentVersion: string;
readonly mainThread = "main";
sourceCode: {
text: string;
} | undefined;
classifiers: string[];
/**
* BacktraceReport generated by library allows you to
* automatically send reports to Backtrace via send method
* @deprecated Please use `client.sendReport` instead
*/
send: (callback: (err?: Error) => void) => void | undefined;
/**
* BacktraceReport generated by library allows you to
* automatically send reports to Backtrace via send method
* @deprecated Please use `client.sendReport` instead
*/
sendSync: (callback: (err?: Error) => void) => void | undefined;
/**
* Thread information about current application
*/
stackTrace: BacktraceStackTrace;
/**
* Current report attributes
*/
private attributes;
/**
* Backtrace complex objet
*/
private annotations;
/**
* Create new BacktraceReport - report information that will collect information
* for Backtrace.
*
* Possible existing scenarios:
* arg1: error + arg2: attributes = all required
* arg1: object, arg2: nothing
*
* @param err Error or message - content to report
* @param clientAttributes Report attributes dictionary
* @param breadcrumbs list of breadcrumbs to include as an attachment
* @param attachment an client-provided attachment
*/
constructor(err?: Error | string, clientAttributes?: {
[index: string]: any;
}, breadcrumbs?: IBreadcrumb[] | undefined, attachment?: string | object | undefined);
/**
* Check if report contains exception information
*/
isExceptionTypeReport(): boolean;
getPayload(): Error | string;
/**
* Set error or message in BacktraceReport object
* @param err Current error
*/
setError(err: Error | string): void;
log(log: string): void;
trace(log: string): void;
/**
* Add new attributes to existing report attributes
* @param attributes new report attributes object
*/
addObjectAttributes(attributes: {
[index: string]: any;
}): void;
addAttribute(key: string, value: any): void;
addAnnotation(key: string, value: object): void;
toJson(): IBacktraceData;
toFormData(): FormData;
/**
* @deprecated This method is not supported
*/
setSourceCodeOptions(tabWidth: number, contextLineCount: number): void;
private collectReportInformation;
private detectReportType;
private readErrorAttributes;
private readAnnotation;
private getSerializableError;
private splitAttributesFromAnnotations;
}