(stackParser: StackParser, ex: Error)
| 30 | * This function creates an exception from a JavaScript Error |
| 31 | */ |
| 32 | export 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 | |
| 52 | function eventFromPlainObject( |
| 53 | stackParser: StackParser, |
no test coverage detected