Skip to content

Conversation

@deepu-mungamuri94
Copy link

@W-19978113@

What does this PR do?

This adds a robust error capture and reporting system for LWC local development that captures runtime errors from the browser and displays them formatted in the terminal.

Features:

  • ErrorStore: In-memory store for runtime errors with deduplication
  • Error Capture HTTP Server: Standalone server on LWC port + 1
  • Error Middleware: Express middleware for capturing/querying errors
  • Error Formatter: CLI-friendly formatted error output with colors
  • Stack Trace Utils: Parse and sanitize stack traces

Components:

  • src/lwc-dev-server/errorStore.ts: Error storage with statistics
  • src/lwc-dev-server/errorHttpServer.ts: HTTP server for error endpoints
  • src/lwc-dev-server/errorMiddleware.ts: Express middleware
  • src/shared/errorFormatter.ts: Format errors for terminal display
  • src/shared/stackTraceUtils.ts: Stack trace parsing utilities
  • src/types/errorPayload.ts: TypeScript types for error diagnostics

Testing:

  • Comprehensive unit tests for all error capture components
  • E2E tests for error capture workflow
  • Test fixtures for validation

Updated:

  • package.json: Added express dependency
  • src/lwc-dev-server/index.ts: Integrated error capture server
  • yarn.lock: Updated dependencies

Error Capture Endpoints:

  • POST /_dev/errors - Capture error reports
  • GET /_dev/errors - Query errors with filters
  • DELETE /_dev/errors - Clear all errors
  • GET /_dev/errors/stats - Get error statistics
  • GET /_dev/health - Health check

Auto-clears errors on server restart. Can also manually clear via DELETE endpoint.

What issues does this PR fix or reference?

@salesforce-cla
Copy link

Thanks for the contribution! Unfortunately we can't verify the commit author(s): dmungamuri <d***@s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, refresh the status of this Pull Request.

@deepu-mungamuri94 deepu-mungamuri94 force-pushed the @W-19978113/dmungamuri/error-capture-system branch from 1effd82 to 8365c38 Compare October 26, 2025 21:02
@W-19978113@

This adds a robust error capture and reporting system for LWC local
development that captures runtime errors from the browser and displays
them formatted in the terminal.

Features:
- ErrorStore: In-memory store for runtime errors with deduplication
- Error Capture HTTP Server: Standalone server on LWC port + 1
- Error Middleware: Express middleware for capturing/querying errors
- Error Formatter: CLI-friendly formatted error output with colors
- Stack Trace Utils: Parse and sanitize stack traces

Components:
- src/lwc-dev-server/errorStore.ts: Error storage with statistics
- src/lwc-dev-server/errorHttpServer.ts: HTTP server for error endpoints
- src/lwc-dev-server/errorMiddleware.ts: Express middleware
- src/shared/errorFormatter.ts: Format errors for terminal display
- src/shared/stackTraceUtils.ts: Stack trace parsing utilities
- src/types/errorPayload.ts: TypeScript types for error diagnostics

Testing:
- Comprehensive unit tests for all error capture components
- E2E tests for error capture workflow
- Test fixtures for validation

Updated:
- package.json: Added express dependency
- src/lwc-dev-server/index.ts: Integrated error capture server
- yarn.lock: Updated dependencies

Error Capture Endpoints:
- POST   /_dev/errors       - Capture error reports
- GET    /_dev/errors       - Query errors with filters
- DELETE /_dev/errors       - Clear all errors
- GET    /_dev/errors/stats - Get error statistics
- GET    /_dev/health       - Health check

Auto-clears errors on server restart. Can also manually clear via
DELETE endpoint.
@deepu-mungamuri94 deepu-mungamuri94 force-pushed the @W-19978113/dmungamuri/error-capture-system branch from 8365c38 to d95fc3b Compare October 26, 2025 21:20
… logs

- Remove verbose console logs on error capture server startup
- Add server-side cleanup for _clientParsedStack field (client-only data)
- Keep filtered stack traces (show local source only, hide framework code)
- Improve code documentation and comments
@deepu-mungamuri94 deepu-mungamuri94 force-pushed the @W-19978113/dmungamuri/error-capture-system branch from a31362f to 5d0975f Compare October 27, 2025 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant