(event: SentryEvent, dsn: DsnComponents)
| 138 | } |
| 139 | |
| 140 | async function sendEvent(event: SentryEvent, dsn: DsnComponents): Promise<boolean> { |
| 141 | const endpoint = getEnvelopeEndpoint(dsn); |
| 142 | const envelope = createEnvelope(event, dsn); |
| 143 | try { |
| 144 | const response = await fetch(endpoint, { |
| 145 | method: 'POST', |
| 146 | headers: { 'Content-Type': 'application/x-sentry-envelope' }, |
| 147 | body: envelope, |
| 148 | }); |
| 149 | if (response.status >= 200 && response.status < 300) return true; |
| 150 | console.warn(`[Sentry] Failed to send event: HTTP ${response.status}`); |
| 151 | return false; |
| 152 | } catch (error) { |
| 153 | console.error('[Sentry] Failed to send event:', error); |
| 154 | return false; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | function getReleaseFromEASEnv(env: EASBuildEnv): string | undefined { |
| 159 | // Honour explicit override first |
no test coverage detected