| … | … | @@ -141,11 +141,17 @@ const broadcastPushWithResults = async (payloadObj) => { |
| 141 | 141 | try { |
| 142 | 142 | const res = await sendWebPush(subscription, payloadObj) |
| 143 | 143 | const status = res.status |
| 144 | let body |
| 145 | if (!res.ok) { |
| 146 | try { |
| 147 | body = (await res.text()).slice(0, 2000) |
| 148 | } catch {} |
| 149 | } |
| 144 | 150 | if (status === 404 || status === 410) dead.add(endpoint) |
| 145 | 151 | if (!res.ok) { |
| 146 | | console.log('webpush send failed', { endpoint: redactEndpoint(endpoint), status }) |
| 152 | console.log('webpush send failed', { endpoint: redactEndpoint(endpoint), status, body }) |
| 147 | 153 | } |
| 148 | | return { endpoint: redactEndpoint(endpoint), status, ok: res.ok } |
| 154 | return { endpoint: redactEndpoint(endpoint), status, ok: res.ok, body } |
| 149 | 155 | } catch (err) { |
| 150 | 156 | console.log('webpush send error', { endpoint: redactEndpoint(endpoint), err: String(err?.message || err) }) |
| 151 | 157 | return { endpoint: redactEndpoint(endpoint), error: String(err?.message || err) } |