Skip to content

graceful error handling - #405

Merged
Bohreromir merged 7 commits into
mainfrom
fix-359-error-handling
Oct 29, 2026
Merged

Bohreromir merged 7 commits into
mainfrom
fix-359-error-handling

Conversation

@Bohreromir

@Bohreromir Bohreromir commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Description

#359

  • API routes now always return errors as {message} (SvelteKit's App.Error)
  • Unknown pages and server errors now show a translated error page with the request ID, rendered inside the app layout so navigation stays visible
  • unknown API paths return a JSON 404

Docs

Release note

Checklist

Author

  • AI review done, findings addressed
  • Tests added or updated
  • Changelog updated (if the repo keeps one)

Reviewer

  • Useful comments and logging
  • Docs added or updated per the style guide

Acceptance

  • Check for release notes and docs

The Trino query and storage connections endpoints answered errors with
{error}, and the copy job endpoint with {status: 'not_found'}, while every
other route returns SvelteKit's App.Error ({message}). Use error() there
too and read the message on the client with a shared readErrorMessage
helper, so the Trino submit shows the server's reason again.
Errors outside the storage browser fell back to SvelteKit's unstyled
default page. Add a shared ErrorPanel with a translated title and
description per status, the request ID for unexpected errors, and links
back to the dashboard or to retry. Server messages are not shown, since
they may carry raw upstream details (#304).

Unknown pages now render a 404 inside the app layout through a catch-all
route, and unknown API paths answer with a JSON 404 instead of HTML. The
auth guard no longer treats (app) routes as public because their path
starts with a public prefix, so paths like /auth/login/x still require
sign-in. src/error.html is a static fallback for errors thrown in hooks.
- Catalogue browser: show the server's message instead of the raw JSON
  body, and a translated message when the server cannot be reached.
- Preview: the 403/404 messages were never shown, because the storage API
  already throws a StorageError for non-OK responses. Map the error code
  in the catch and drop the unreachable !res.ok branches, also in
  DirectoryDetails along with its unused message key.
- directory-size: send the message of SvelteKit's HttpError, which is not
  an Error instance, instead of "Unknown error".
- Storage layout: a failed bucket fetch for the active connection now
  shows an error above the connect form instead of silently looking
  disconnected.
- Storage and settings connection actions return translated errors, and
  switching to a saved connection that fails now says why. The settings
  page shows action errors at all.
- readErrorMessage ignores 401s and unexpected errors, whose bodies only
  carry a generic English text, so callers fall back to translated
  messages. A failed directory size calculation and a failed preview
  download show translated messages too.
- The auth guard matches public routes by route id instead of path
  prefix, so lookalike paths such as /metricsfoo require sign-in.
- The root error page does not link failing sign-in pages to the
  dashboard, which would redirect straight back to sign-in.
- ErrorPanel replaces StorageErrorPanel, with optional title,
  description and actions.
- The 404 page uses "Page not found" as page title and heading.
- Type the storage layout's buckets error reason.
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 66.46% 8968 / 13492
🔵 Statements 65.28% 12089 / 18516
🔵 Functions 67% 2896 / 4322
🔵 Branches 56.67% 5183 / 9145
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/hooks.server.ts 0% 0% 0% 0% 17-141
src/lib/client/api-error.ts 100% 100% 100% 100%
src/lib/components/ErrorPanel.svelte 97.72% 100% 90.9% 100% 69
src/lib/components/catalog/CatalogBrowser.svelte 0% 0% 0% 0% 22-290
src/lib/components/storage/modals/PreviewModal.svelte 70.71% 60.82% 74.77% 67.08% 153, 163, 165, 169, 181, 215-220, 257-259, 303, 334-357, 363, 439, 460-552, 556, 560-562, 570, 586-587, 606-622, 630-647, 653-654, 660, 681-716, 731-759, 787-789, 813-817, 812, 827, 826, 786, 857, 899, 898, 895, 1002-1003, 1010-1011, 997, 1085-1082
src/lib/components/storage/modals/details/DirectoryDetails.svelte 0% 0% 0% 0% 24-292
src/lib/storage/storage-fetch.ts 96% 94.44% 100% 100% 30
src/routes/+error.svelte 95.45% 100% 88.88% 100% 16
src/routes/(app)/+error.svelte 0% 100% 0% 0% 7
src/routes/(app)/+layout.svelte 0% 0% 0% 0% 10-104
src/routes/(app)/[...path]/+page.ts 0% 100% 0% 0% 8
src/routes/(app)/api/[...path]/+server.ts 0% 100% 0% 0% 6
src/routes/(app)/api/storage/connections/+server.ts 0% 0% 0% 0% 18-111
src/routes/(app)/api/storage/copy/job/[jobId]/+server.ts 71.42% 50% 100% 90.9% 8, 10, 15, 17
src/routes/(app)/api/storage/directory-size/+server.ts 90.19% 68.75% 100% 91.66% 47, 79-82
src/routes/(app)/api/trino/query/+server.ts 100% 100% 100% 100%
src/routes/(app)/storage/+error.svelte 84% 73.33% 91.66% 94.87% 38-39, 86, 18-19, 32, 51-71, 87
src/routes/(app)/storage/+layout.ts 0% 0% 0% 0% 11-102
src/routes/(app)/storage/+page.svelte 0% 0% 0% 0% 22-174
src/routes/(app)/trino/query-runner.svelte.ts 0% 0% 0% 0% 36-327
Generated in workflow #1179 for commit 68675ba by the Vitest Coverage Report Action

@Bohreromir Bohreromir self-assigned this Oct 26, 2026
@Bohreromir
Bohreromir marked this pull request as ready for review October 26, 2026 13:09
@Bohreromir Bohreromir moved this to Development: Waiting for Review in Stackable Engineering Oct 26, 2026
@Bohreromir
Bohreromir added this pull request to stack #408 October 26, 2026 13:11
@Bohreromir Bohreromir linked an issue Oct 26, 2026 that may be closed by this pull request
4 tasks done
# Conflicts:
#	e2e/storage/connection.spec.ts
#	messages/de.json
#	messages/en.json
#	src/routes/(app)/settings/connections/+page.server.ts
#	src/routes/(app)/settings/connections/+page.svelte
#	src/routes/(app)/storage/+page.server.ts
#	src/routes/(app)/storage/page.server.test.ts
# Conflicts:
#	src/lib/components/storage/shared/StorageErrorPanel.svelte
@Bohreromir
Bohreromir added this pull request to the merge queue Oct 29, 2026
@Bohreromir Bohreromir moved this from Development: Waiting for Review to Development: Done in Stackable Engineering Oct 29, 2026
Merged via the queue into main with commit 036fe33 Oct 29, 2026
12 checks passed
@Bohreromir
Bohreromir deleted the fix-359-error-handling branch October 29, 2026 08:36
@lfrancke lfrancke moved this from Development: Done to Done in Stackable Engineering Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Graceful error handling across the app

2 participants