MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / exceptionFromError

Function exceptionFromError

packages/browser/src/eventbuilder.ts:32–50  ·  view source on GitHub ↗
(stackParser: StackParser, ex: Error)

Source from the content-addressed store, hash-verified

30 * This function creates an exception from a JavaScript Error
31 */
32export function exceptionFromError(stackParser: StackParser, ex: Error): Exception {
33 // Get the frames first since Opera can lose the stack if we touch anything else first
34 const frames = parseStackFrames(stackParser, ex);
35
36 const exception: Exception = {
37 type: extractType(ex),
38 value: extractMessage(ex),
39 };
40
41 if (frames.length) {
42 exception.stacktrace = { frames };
43 }
44
45 if (exception.type === undefined && exception.value === '') {
46 exception.value = 'Unrecoverable error caught';
47 }
48
49 return exception;
50}
51
52function eventFromPlainObject(
53 stackParser: StackParser,

Callers 10

firefox.test.tsFile · 0.90
chromium.test.tsFile · 0.90
misc.test.tsFile · 0.90
opera.test.tsFile · 0.90
ie.test.tsFile · 0.90
react.test.tsFile · 0.90
safari.test.tsFile · 0.90
eventFromPlainObjectFunction · 0.70
eventFromErrorFunction · 0.70

Calls 3

extractTypeFunction · 0.85
extractMessageFunction · 0.85
parseStackFramesFunction · 0.70

Tested by

no test coverage detected