Skip to content

Commit e60b87b

Browse files
committed
add docstrings to Mechanism type
1 parent 952850f commit e60b87b

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

packages/types/src/mechanism.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
1-
/** JSDoc */
1+
/**
2+
* Metadata about a captured exception, intended to provide a hint as to the means by which it was captured.
3+
*/
24
export interface Mechanism {
5+
/**
6+
* For now, restricted to `onerror`, `onunhandledrejection` (both obvious), `instrument` (the result of
7+
* auto-instrumentation), and `generic` (everything else). Converted to a tag on ingest.
8+
*/
39
type: string;
10+
11+
/**
12+
* In theory, whether or not the exception has been handled by the user. In practice, whether or not we see it before
13+
* it hits the global error/rejection handlers, whether through explicit handling by the user or auto instrumentation.
14+
* Converted to a tag on ingest and used in various ways in the UI.
15+
*/
416
handled: boolean;
17+
18+
/**
19+
* Arbitrary data to be associated with the mechanism (for example, errors coming from event handlers include the
20+
* handler name and the event target. Will show up in the UI directly above the stacktrace.
21+
*/
522
data?: {
623
[key: string]: string | boolean;
724
};
25+
26+
/**
27+
* True when `captureException` is called with anything other than an instance of `Error` (or, in the case of browser,
28+
* an instance of `ErrorEvent`, `DOMError`, or `DOMException`). causing us to create a synthetic error in an attempt
29+
* to recreate the stacktrace.
30+
*/
831
synthetic?: boolean;
932
}

0 commit comments

Comments
 (0)