Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enhanced Error Handling with Source Map Support and Improved Developer Experience
Overview
This PR introduces comprehensive error handling improvements for OpenComponents, focusing on better debugging capabilities in local development environments and enhanced error presentation in the registry preview interface.
Key Changes
1. Source Map Integration for Better Error Debugging
Added a new
format-error-stack.tsmodule that processes JavaScript stack traces using source maps to provide meaningful error locations in TypeScript source files instead of compiled JavaScript. This is particularly valuable for local development where components are written in TypeScript.Features:
2. Enhanced Error Response Structure
Modified the component execution error handling in
get-component.tsto include processed stack traces and code frames when running in local mode. The error response now includes:3. Improved Registry Preview Error UI
Completely redesigned the error overlay in the registry preview interface with:
4. Enhanced Developer Experience
oc-client-browserto v2.1.5 and addedsource-mapdependencyTechnical Implementation
The source map processing works by:
source-maplibrary to map compiled locations back to sourceThe error overlay uses a self-contained JavaScript implementation that listens for
oc:errorevents and dynamically creates the error UI when needed.Usage
The improvements are automatically active in local development mode. When a component fails to render:
Benefits
The changes maintain backward compatibility while significantly improving the development experience for OpenComponents users.