forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bugsnag.d.ts
90 lines (81 loc) · 3.02 KB
/
bugsnag.d.ts
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Type definitions for Bugsnag v2.5.0
// Project: https://github.com/bugsnag/bugsnag-js
// Definitions by: Delisa Mason <https://github.com/kattrali>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface BugsnagUser {
id?: string,
name?: string,
email?: string
}
interface BugsnagStatic {
/** Bugsnag project API key */
apiKey: string;
/** The client application version */
appVersion: string;
/** true if Bugsnag should be automatically notified of errors which are
* sent to `window.onerror`
*/
autoNotify: boolean;
/** Callback run before error reports are sent to Bugsnag.
* Payload and metadata information can be altered or removed altogether.
* To cancel sending the report, return false from this function.
*/
beforeNotify: (payload: any, metaData: any) => boolean;
/** The pathname of the current page, not including the fragment identifier
* nor search parameters
*/
context: string;
/** Disables console-based logging. Defaults to false. */
disableLog: boolean;
/** The address used to send errors to Bugsnag. The default is
* `https://notify.bugsnag.com/js`
*/
endpoint: string;
/** Enables sending inline scripts on the page to Bugsnag to assist with
* debugging. Defaults to true
*/
inlineScript: boolean;
/** The maximum depth to parse the error stack */
maxDepth: number;
/** Additional metadata to send to Bugsnag with every error. */
metaData: any;
/** The method used for the notify request. The default is a temporary
* JavaScript image object, however Chrome apps/extensions and other
* applications where XHR is needed can use `xhr` instead.
*/
notifyHandler: string;
/** The releases stages during which Bugsnag will be notified of errors. */
notifyReleaseStages: string[];
/** The recorded root of the project. The default is the current host
* address (protocol and domain).
*/
projectRoot: string;
/** Current phase of the application release process. The default is
* `production`
*/
releaseStage: string;
/** Information about the current user which is sent to Bugsnag with
* exception reports
*/
user: BugsnagUser;
/** Continue catching exceptions after the page error limit is reached.
* Useful for long-running single-page apps
*/
refresh(): void;
/** Remove Bugsnag from the window object and restore the previous
* binding
*/
noConflict(): BugsnagStatic;
/** Send caught exceptions to Bugsnag. Valid severity values are `info`,
* `warning`, and `error`, in order of increasing severity.
*/
notifyException(exception: Error, name?: string, metaData?: any,
severity?: string): void;
/** Send custom errors to Bugsnag */
notify(name: string, message: string, metaData?: any,
severity?: string): void;
}
declare var Bugsnag: BugsnagStatic;
declare module "Bugsnag" {
export = Bugsnag;
}