personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

convey: surface init observer and finalize failures

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+40 -9
+40 -9
convey/templates/init.html
··· 270 270 } 271 271 272 272 async function loadObservers() { 273 + const emptyEl = document.getElementById('observer-empty'); 274 + const errorEl = document.getElementById('observer-error'); 273 275 try { 274 - const resp = await fetch('/init/observers'); 275 - const data = await resp.json(); 276 - const emptyEl = document.getElementById('observer-empty'); 276 + const data = await window.apiJson('/init/observers'); 277 + if (errorEl) { 278 + errorEl.hidden = true; 279 + errorEl.textContent = ''; 280 + } 277 281 if (data.length > 0) { 278 282 if (emptyEl) emptyEl.style.display = 'none'; 279 283 const labelEl = document.getElementById('observer-label'); ··· 290 294 } else { 291 295 if (emptyEl) emptyEl.style.display = 'block'; 292 296 } 293 - } catch (err) {} 297 + } catch (err) { 298 + if (emptyEl) emptyEl.style.display = 'none'; 299 + if (errorEl) { 300 + errorEl.textContent = err?.serverMessage || "Couldn't check for observers - reload to try again."; 301 + errorEl.hidden = false; 302 + } 303 + window.logError(err, { context: 'init-observers' }); 304 + } 294 305 } 295 306 296 307 function setRetentionMode(mode) { ··· 315 326 } 316 327 317 328 async function finalize() { 329 + const passwordEl = document.getElementById('password'); 330 + const errorEl = document.getElementById('finalize-error'); 318 331 try { 319 - const resp = await fetch('/init/finalize', { 320 - method: 'POST', headers: {'Content-Type': 'application/json'}, 332 + const data = await window.apiJson('/init/finalize', { 333 + method: 'POST', 334 + headers: {'Content-Type': 'application/json'}, 321 335 body: JSON.stringify({ 322 336 password: document.getElementById('password').value, 323 337 name: document.getElementById('name').value.trim(), ··· 328 342 retention_days: parseInt(document.getElementById('retention-days-input').value) || 7 329 343 }) 330 344 }); 331 - const data = await resp.json(); 345 + if (errorEl) { 346 + errorEl.hidden = true; 347 + errorEl.textContent = ''; 348 + } 332 349 if (data.success && data.redirect) window.location.href = data.redirect; 333 350 else if (data.error) { 334 - showFieldStatus(document.getElementById('password'), 'error', data.error); 351 + showFieldStatus(passwordEl, 'error', data.error); 335 352 } 336 - } catch (err) {} 353 + } catch (err) { 354 + if (err instanceof window.ApiError && err.status === 400 && err.serverMessage) { 355 + if (errorEl) { 356 + errorEl.hidden = true; 357 + errorEl.textContent = ''; 358 + } 359 + showFieldStatus(passwordEl, 'error', err.serverMessage); 360 + return; 361 + } 362 + if (errorEl) { 363 + errorEl.textContent = err?.serverMessage || "Couldn't finalize setup. Check your connection and try again."; 364 + errorEl.hidden = false; 365 + } 366 + window.logError(err, { context: 'init-finalize' }); 367 + } 337 368 } 338 369 </script> 339 370 </body>