(event: Event, newMechanism?: Partial<Mechanism>)
| 107 | * @hidden |
| 108 | */ |
| 109 | export function addExceptionMechanism(event: Event, newMechanism?: Partial<Mechanism>): void { |
| 110 | const firstException = getFirstException(event); |
| 111 | if (!firstException) { |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | const defaultMechanism = { type: 'generic', handled: true }; |
| 116 | const currentMechanism = firstException.mechanism; |
| 117 | firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism }; |
| 118 | |
| 119 | if (newMechanism && 'data' in newMechanism) { |
| 120 | const mergedData = { ...currentMechanism?.data, ...newMechanism.data }; |
| 121 | firstException.mechanism.data = mergedData; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string |
| 126 | const SEMVER_REGEXP = |
no test coverage detected