Commit a23d1cb
authored
feat(error-reporting): CrashReport panel + Sentry-compatible client (#247)
* feat(error-reporting): add CrashReport panel + Sentry-compatible client
Drops into the fileshare error boundary: on any uncaught render-time
throw inside the encrypt flow, render a "Tell PostGuard" panel that
captures the exception (with rich client context: URL, viewport, UA,
locale, app version) and POSTs it to the configured GlitchTip / Sentry
endpoint via @sentry/browser. Reset path wipes encryptState and resets
the boundary so the user can keep going.
- `src/lib/errorReporting.ts` — lazy SDK init, manual-capture only
(no global error / unhandledrejection hooks, no breadcrumbs), 3 s
flush budget.
- `src/lib/components/filesharing/CrashReport.svelte` — two-button
panel: primary "Tell PostGuard" (flips to "Sending…" → "Thank you!"
in-place, width pinned), secondary "Try again".
- `src/lib/env.ts` — `GLITCHTIP_DSN` runtime config flag; empty value
disables reporting at module load.
- `src/hooks.client.ts` — initialises the SDK on app boot.
- `src/routes/(app)/fileshare/+page.svelte` — wraps the encrypt flow
in `<svelte:boundary>` with CrashReport as the `failed` snippet.
- Locale strings (`crash` section, en + nl).
- `static/config.js` — local dev DSN matching the GlitchTip stack in
docker-compose. Deployed environments override via the Terraform
ConfigMap.
- `docker-compose.yml` — local GlitchTip stack (postgres + redis +
web + worker + idempotent init Job that seeds the admin user, the
PostGuard org, the postguard-website project, and a pinned
ProjectKey UUID so the DSN survives `docker compose down -v`).
- `package.json` / `package-lock.json` — adds `@sentry/browser ^10`
and bumps `svelte-preprocess` to `^6.0.5` (the older 6.0.3 declared
`typescript@^5.0.0` only, which broke `npm ci` after the Sentry
install pulled in a wider tsc range).
Pairs with the postguard-ops GlitchTip deployment.
* review: dobby fixes on the GlitchTip PR
- docker-compose.yml glitchtip-init: invert the DEV_KEY rewrite
condition. GlitchTip auto-creates a default ProjectKey on Project
save, so get_or_create returns that auto-created key
(key_created=False) and the `defaults={'public_key': DEV_KEY}`
clause is ignored. The previous `if key_created and …` branch was
unreachable, leaving the DSN pinned UUID never applied on fresh
volumes.
- errorReporting.ts: drop `navigator.platform` (deprecated; Firefox
returns "" already).
- CrashReport.svelte:
- Wrap reportError() in try/catch so a synchronous SDK throw can't
leave the button stuck on "Sending…".
- Add `:focus-visible` outline on .crash-btn (WCAG 2.4.7).
- Move the failed-state <p> into a stable role=status / aria-live
live region so screen readers announce it (WCAG 4.1.3).
- fileshare/+page.svelte: move <svelte:boundary> above <FileInput>
so a render-time error in FileInput is caught by CrashReport
instead of crashing the whole page.1 parent d52ee5b commit a23d1cb
11 files changed
Lines changed: 530 additions & 57 deletions
File tree
- src
- lib
- components/filesharing
- locales
- static
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
100 | 258 | | |
101 | 259 | | |
102 | 260 | | |
| |||
120 | 278 | | |
121 | 279 | | |
122 | 280 | | |
| 281 | + | |
| 282 | + | |
0 commit comments