Skip to content

fix(logging): include URL params and simplify TRPCError cause#747

Merged
danadajian merged 2 commits intomainfrom
feat/improve-error-logging
Mar 26, 2026
Merged

fix(logging): include URL params and simplify TRPCError cause#747
danadajian merged 2 commits intomainfrom
feat/improve-error-logging

Conversation

@danadajian
Copy link
Contributor

Summary

  • Parses the Referer header in the onError handler to extract all SPA URL parameters (commitHash, owner, repo, bucket, etc.) and spreads them into every error log entry
  • This ensures URL params are available in error logs even for procedures (e.g. fetchCurrentPage) that don't receive owner/repo as tRPC inputs
  • Simplifies all TRPCError cause fields from objects ({ event: 'FOO', owner, repo, ... }) to plain event name strings ('FOO') — the extra context is now sourced from the URL params

Changes

  • app/server.tsonError now extracts urlParams from req.headers.get('referer') and logs them alongside cause; input removed (superseded by URL params)
  • app/backend/src/fetchCurrentPage.tscause simplified to string in both throws
  • app/backend/src/getGroupedKeys.tscause simplified to string in both throws
  • app/backend/src/acceptVisualChanges.tscause simplified to string in both throws
  • app/backend/src/getOctokit.tscause simplified to string in all three throws
  • app/backend/src/updateCommitStatus.tscause simplified to string

Test plan

  • Trigger a fetchCurrentPage error (e.g. invalid hash) and verify the server log includes owner, repo, bucket, commitHash from the browser URL alongside the cause event name
  • Verify no TypeScript errors (bun tsc)

Generated with Claude Code

…ror logs

Parses the Referer header in the onError handler to extract all SPA URL
parameters (commitHash, owner, repo, bucket, etc.) and merges them into
every error log entry — even for procedures that don't receive all params
as input. Simplifies TRPCError cause fields from objects to plain event
name strings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danadajian danadajian changed the title feat(logging): include URL params and simplify TRPCError cause fix(logging): include URL params and simplify TRPCError cause Mar 26, 2026
@danadajian danadajian merged commit 536683c into main Mar 26, 2026
3 checks passed
@danadajian danadajian deleted the feat/improve-error-logging branch March 26, 2026 21:17
@eg-oss-ci
Copy link

🎉 This PR is included in version 1.41.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants