@pithyjs/router 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +621 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/router/core/config.d.ts +22 -0
- package/dist/router/core/config.d.ts.map +1 -0
- package/dist/router/core/config.js +54 -0
- package/dist/router/core/config.js.map +1 -0
- package/dist/router/core/constants.d.ts +89 -0
- package/dist/router/core/constants.d.ts.map +1 -0
- package/dist/router/core/constants.js +95 -0
- package/dist/router/core/constants.js.map +1 -0
- package/dist/router/core/history.d.ts +54 -0
- package/dist/router/core/history.d.ts.map +1 -0
- package/dist/router/core/history.js +89 -0
- package/dist/router/core/history.js.map +1 -0
- package/dist/router/core/matcher.d.ts +43 -0
- package/dist/router/core/matcher.d.ts.map +1 -0
- package/dist/router/core/matcher.js +242 -0
- package/dist/router/core/matcher.js.map +1 -0
- package/dist/router/core/params.d.ts +88 -0
- package/dist/router/core/params.d.ts.map +1 -0
- package/dist/router/core/params.js +150 -0
- package/dist/router/core/params.js.map +1 -0
- package/dist/router/core/pipeline.d.ts +90 -0
- package/dist/router/core/pipeline.d.ts.map +1 -0
- package/dist/router/core/pipeline.js +323 -0
- package/dist/router/core/pipeline.js.map +1 -0
- package/dist/router/core/route-tree.d.ts +76 -0
- package/dist/router/core/route-tree.d.ts.map +1 -0
- package/dist/router/core/route-tree.js +143 -0
- package/dist/router/core/route-tree.js.map +1 -0
- package/dist/router/core/router.d.ts +229 -0
- package/dist/router/core/router.d.ts.map +1 -0
- package/dist/router/core/router.js +762 -0
- package/dist/router/core/router.js.map +1 -0
- package/dist/router/core/types.d.ts +387 -0
- package/dist/router/core/types.d.ts.map +1 -0
- package/dist/router/core/types.js +22 -0
- package/dist/router/core/types.js.map +1 -0
- package/dist/router/core/utils.d.ts +66 -0
- package/dist/router/core/utils.d.ts.map +1 -0
- package/dist/router/core/utils.js +152 -0
- package/dist/router/core/utils.js.map +1 -0
- package/dist/router/features/coordinator.d.ts +75 -0
- package/dist/router/features/coordinator.d.ts.map +1 -0
- package/dist/router/features/coordinator.js +203 -0
- package/dist/router/features/coordinator.js.map +1 -0
- package/dist/router/features/errors/error-codes.d.ts +107 -0
- package/dist/router/features/errors/error-codes.d.ts.map +1 -0
- package/dist/router/features/errors/error-codes.js +247 -0
- package/dist/router/features/errors/error-codes.js.map +1 -0
- package/dist/router/features/errors/error-resolution.d.ts +31 -0
- package/dist/router/features/errors/error-resolution.d.ts.map +1 -0
- package/dist/router/features/errors/error-resolution.js +47 -0
- package/dist/router/features/errors/error-resolution.js.map +1 -0
- package/dist/router/features/errors/error-types.d.ts +60 -0
- package/dist/router/features/errors/error-types.d.ts.map +1 -0
- package/dist/router/features/errors/error-types.js +57 -0
- package/dist/router/features/errors/error-types.js.map +1 -0
- package/dist/router/features/errors/global-error-fallback.d.ts +33 -0
- package/dist/router/features/errors/global-error-fallback.d.ts.map +1 -0
- package/dist/router/features/errors/global-error-fallback.js +182 -0
- package/dist/router/features/errors/global-error-fallback.js.map +1 -0
- package/dist/router/features/errors/index.d.ts +15 -0
- package/dist/router/features/errors/index.d.ts.map +1 -0
- package/dist/router/features/errors/index.js +18 -0
- package/dist/router/features/errors/index.js.map +1 -0
- package/dist/router/features/errors/router-errors.d.ts +44 -0
- package/dist/router/features/errors/router-errors.d.ts.map +1 -0
- package/dist/router/features/errors/router-errors.js +53 -0
- package/dist/router/features/errors/router-errors.js.map +1 -0
- package/dist/router/features/guards/engine.d.ts +40 -0
- package/dist/router/features/guards/engine.d.ts.map +1 -0
- package/dist/router/features/guards/engine.js +67 -0
- package/dist/router/features/guards/engine.js.map +1 -0
- package/dist/router/features/guards/index.d.ts +52 -0
- package/dist/router/features/guards/index.d.ts.map +1 -0
- package/dist/router/features/guards/index.js +95 -0
- package/dist/router/features/guards/index.js.map +1 -0
- package/dist/router/features/loaders/cache.d.ts +60 -0
- package/dist/router/features/loaders/cache.d.ts.map +1 -0
- package/dist/router/features/loaders/cache.js +80 -0
- package/dist/router/features/loaders/cache.js.map +1 -0
- package/dist/router/features/loaders/engine.d.ts +17 -0
- package/dist/router/features/loaders/engine.d.ts.map +1 -0
- package/dist/router/features/loaders/engine.js +27 -0
- package/dist/router/features/loaders/engine.js.map +1 -0
- package/dist/router/features/loaders/index.d.ts +49 -0
- package/dist/router/features/loaders/index.d.ts.map +1 -0
- package/dist/router/features/loaders/index.js +112 -0
- package/dist/router/features/loaders/index.js.map +1 -0
- package/dist/router/features/loading-ui-manager.d.ts +69 -0
- package/dist/router/features/loading-ui-manager.d.ts.map +1 -0
- package/dist/router/features/loading-ui-manager.js +209 -0
- package/dist/router/features/loading-ui-manager.js.map +1 -0
- package/dist/router/features/module-loader.d.ts +50 -0
- package/dist/router/features/module-loader.d.ts.map +1 -0
- package/dist/router/features/module-loader.js +121 -0
- package/dist/router/features/module-loader.js.map +1 -0
- package/dist/router/features/outlet/errors.d.ts +24 -0
- package/dist/router/features/outlet/errors.d.ts.map +1 -0
- package/dist/router/features/outlet/errors.js +96 -0
- package/dist/router/features/outlet/errors.js.map +1 -0
- package/dist/router/features/outlet/index.d.ts +45 -0
- package/dist/router/features/outlet/index.d.ts.map +1 -0
- package/dist/router/features/outlet/index.js +95 -0
- package/dist/router/features/outlet/index.js.map +1 -0
- package/dist/router/features/outlet/mount.d.ts +38 -0
- package/dist/router/features/outlet/mount.d.ts.map +1 -0
- package/dist/router/features/outlet/mount.js +301 -0
- package/dist/router/features/outlet/mount.js.map +1 -0
- package/dist/router/features/outlet/segment-chain.d.ts +16 -0
- package/dist/router/features/outlet/segment-chain.d.ts.map +1 -0
- package/dist/router/features/outlet/segment-chain.js +62 -0
- package/dist/router/features/outlet/segment-chain.js.map +1 -0
- package/dist/router/features/prefetch/index.d.ts +97 -0
- package/dist/router/features/prefetch/index.d.ts.map +1 -0
- package/dist/router/features/prefetch/index.js +345 -0
- package/dist/router/features/prefetch/index.js.map +1 -0
- package/dist/router/features/ux/focus.d.ts +62 -0
- package/dist/router/features/ux/focus.d.ts.map +1 -0
- package/dist/router/features/ux/focus.js +136 -0
- package/dist/router/features/ux/focus.js.map +1 -0
- package/dist/router/features/ux/live-region.d.ts +81 -0
- package/dist/router/features/ux/live-region.d.ts.map +1 -0
- package/dist/router/features/ux/live-region.js +166 -0
- package/dist/router/features/ux/live-region.js.map +1 -0
- package/dist/router/features/ux/scroll-focus.d.ts +105 -0
- package/dist/router/features/ux/scroll-focus.d.ts.map +1 -0
- package/dist/router/features/ux/scroll-focus.js +111 -0
- package/dist/router/features/ux/scroll-focus.js.map +1 -0
- package/dist/router/features/ux/scroll.d.ts +71 -0
- package/dist/router/features/ux/scroll.d.ts.map +1 -0
- package/dist/router/features/ux/scroll.js +137 -0
- package/dist/router/features/ux/scroll.js.map +1 -0
- package/dist/router/features/ux/transitions.d.ts +120 -0
- package/dist/router/features/ux/transitions.d.ts.map +1 -0
- package/dist/router/features/ux/transitions.js +235 -0
- package/dist/router/features/ux/transitions.js.map +1 -0
- package/dist/router/integration/directive-binder.d.ts +20 -0
- package/dist/router/integration/directive-binder.d.ts.map +1 -0
- package/dist/router/integration/directive-binder.js +139 -0
- package/dist/router/integration/directive-binder.js.map +1 -0
- package/dist/router/integration/directives.d.ts +42 -0
- package/dist/router/integration/directives.d.ts.map +1 -0
- package/dist/router/integration/directives.js +109 -0
- package/dist/router/integration/directives.js.map +1 -0
- package/dist/router/integration/history-adapter.d.ts +76 -0
- package/dist/router/integration/history-adapter.d.ts.map +1 -0
- package/dist/router/integration/history-adapter.js +157 -0
- package/dist/router/integration/history-adapter.js.map +1 -0
- package/dist/router/integration/hmr.d.ts +83 -0
- package/dist/router/integration/hmr.d.ts.map +1 -0
- package/dist/router/integration/hmr.js +160 -0
- package/dist/router/integration/hmr.js.map +1 -0
- package/dist/router/integration/link-interceptor.d.ts +49 -0
- package/dist/router/integration/link-interceptor.d.ts.map +1 -0
- package/dist/router/integration/link-interceptor.js +94 -0
- package/dist/router/integration/link-interceptor.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.router.error-codes",
|
|
4
|
+
"title": "Router Error Code Taxonomy",
|
|
5
|
+
"category": "types"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
/** @codexApi {"parent":"pithy.router.error-codes","name":"RouterErrorCode","stability":"stable","signature":"enum RouterErrorCode"} */
|
|
9
|
+
/**
|
|
10
|
+
* Canonical error codes for router errors
|
|
11
|
+
* Provides deterministic error categorization and handling
|
|
12
|
+
*/
|
|
13
|
+
export var RouterErrorCode;
|
|
14
|
+
(function (RouterErrorCode) {
|
|
15
|
+
// ========== Loader Errors (1xxx) ==========
|
|
16
|
+
/** Loader function threw an error */
|
|
17
|
+
RouterErrorCode["LOADER_EXECUTION_ERROR"] = "LOADER_EXECUTION_ERROR";
|
|
18
|
+
/** Loader timed out */
|
|
19
|
+
RouterErrorCode["LOADER_TIMEOUT"] = "LOADER_TIMEOUT";
|
|
20
|
+
/** Loader was aborted/cancelled */
|
|
21
|
+
RouterErrorCode["LOADER_ABORTED"] = "LOADER_ABORTED";
|
|
22
|
+
/** Loader returned LOADER_FAILED sentinel */
|
|
23
|
+
RouterErrorCode["LOADER_FAILED_SENTINEL"] = "LOADER_FAILED_SENTINEL";
|
|
24
|
+
// ========== Guard Errors (2xxx) ==========
|
|
25
|
+
/** Guard function threw an error */
|
|
26
|
+
RouterErrorCode["GUARD_EXECUTION_ERROR"] = "GUARD_EXECUTION_ERROR";
|
|
27
|
+
/** Guard timed out */
|
|
28
|
+
RouterErrorCode["GUARD_TIMEOUT"] = "GUARD_TIMEOUT";
|
|
29
|
+
/** Guard was aborted/cancelled */
|
|
30
|
+
RouterErrorCode["GUARD_ABORTED"] = "GUARD_ABORTED";
|
|
31
|
+
/** Guard denied navigation (returned false) */
|
|
32
|
+
RouterErrorCode["GUARD_DENIED"] = "GUARD_DENIED";
|
|
33
|
+
// ========== Component Errors (3xxx) ==========
|
|
34
|
+
/** Component factory function threw error */
|
|
35
|
+
RouterErrorCode["COMPONENT_FACTORY_ERROR"] = "COMPONENT_FACTORY_ERROR";
|
|
36
|
+
/** Component render threw error */
|
|
37
|
+
RouterErrorCode["COMPONENT_RENDER_ERROR"] = "COMPONENT_RENDER_ERROR";
|
|
38
|
+
/** Component module failed to load */
|
|
39
|
+
RouterErrorCode["COMPONENT_LOAD_ERROR"] = "COMPONENT_LOAD_ERROR";
|
|
40
|
+
/** Component lifecycle hook threw error */
|
|
41
|
+
RouterErrorCode["COMPONENT_LIFECYCLE_ERROR"] = "COMPONENT_LIFECYCLE_ERROR";
|
|
42
|
+
// ========== Navigation Errors (4xxx) ==========
|
|
43
|
+
/** Route not found for path */
|
|
44
|
+
RouterErrorCode["ROUTE_NOT_FOUND"] = "ROUTE_NOT_FOUND";
|
|
45
|
+
/** Navigation was aborted */
|
|
46
|
+
RouterErrorCode["NAVIGATION_ABORTED"] = "NAVIGATION_ABORTED";
|
|
47
|
+
/** Navigation was superseded by another navigation */
|
|
48
|
+
RouterErrorCode["NAVIGATION_SUPERSEDED"] = "NAVIGATION_SUPERSEDED";
|
|
49
|
+
/** Circular redirect detected */
|
|
50
|
+
RouterErrorCode["CIRCULAR_REDIRECT"] = "CIRCULAR_REDIRECT";
|
|
51
|
+
// ========== Error Boundary Errors (5xxx) ==========
|
|
52
|
+
/** Error boundary component failed to load */
|
|
53
|
+
RouterErrorCode["ERROR_BOUNDARY_LOAD_ERROR"] = "ERROR_BOUNDARY_LOAD_ERROR";
|
|
54
|
+
/** Error boundary component threw error during render */
|
|
55
|
+
RouterErrorCode["ERROR_BOUNDARY_RENDER_ERROR"] = "ERROR_BOUNDARY_RENDER_ERROR";
|
|
56
|
+
// ========== Unknown/Generic (9xxx) ==========
|
|
57
|
+
/** Unknown error with no specific categorization */
|
|
58
|
+
RouterErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
59
|
+
})(RouterErrorCode || (RouterErrorCode = {}));
|
|
60
|
+
/** @codexApi {"parent":"pithy.router.error-codes","name":"ErrorSeverity","stability":"stable","signature":"enum ErrorSeverity"} */
|
|
61
|
+
/**
|
|
62
|
+
* Error severity levels for prioritization and handling
|
|
63
|
+
*/
|
|
64
|
+
export var ErrorSeverity;
|
|
65
|
+
(function (ErrorSeverity) {
|
|
66
|
+
/** Critical error - requires immediate attention, blocks navigation */
|
|
67
|
+
ErrorSeverity["CRITICAL"] = "critical";
|
|
68
|
+
/** Error - navigation failed but recoverable */
|
|
69
|
+
ErrorSeverity["ERROR"] = "error";
|
|
70
|
+
/** Warning - operation completed with issues */
|
|
71
|
+
ErrorSeverity["WARNING"] = "warning";
|
|
72
|
+
/** Info - informational message about navigation state */
|
|
73
|
+
ErrorSeverity["INFO"] = "info";
|
|
74
|
+
})(ErrorSeverity || (ErrorSeverity = {}));
|
|
75
|
+
/** @codexApi {"parent":"pithy.router.error-codes","name":"ErrorRecoveryStrategy","stability":"stable","signature":"enum ErrorRecoveryStrategy"} */
|
|
76
|
+
/**
|
|
77
|
+
* Error recovery strategies for different error types
|
|
78
|
+
*/
|
|
79
|
+
export var ErrorRecoveryStrategy;
|
|
80
|
+
(function (ErrorRecoveryStrategy) {
|
|
81
|
+
/** Show error UI with retry button */
|
|
82
|
+
ErrorRecoveryStrategy["SHOW_ERROR_UI"] = "show-error-ui";
|
|
83
|
+
/** Redirect to fallback route */
|
|
84
|
+
ErrorRecoveryStrategy["REDIRECT_FALLBACK"] = "redirect-fallback";
|
|
85
|
+
/** Silent fail - log error but don't show UI */
|
|
86
|
+
ErrorRecoveryStrategy["SILENT_FAIL"] = "silent-fail";
|
|
87
|
+
/** Retry operation automatically */
|
|
88
|
+
ErrorRecoveryStrategy["AUTO_RETRY"] = "auto-retry";
|
|
89
|
+
/** Throw to parent error boundary */
|
|
90
|
+
ErrorRecoveryStrategy["BUBBLE_UP"] = "bubble-up";
|
|
91
|
+
})(ErrorRecoveryStrategy || (ErrorRecoveryStrategy = {}));
|
|
92
|
+
/** @codexApi {"parent":"pithy.router.error-codes","name":"ERROR_TAXONOMY","stability":"stable","signature":"Record<RouterErrorCode, ErrorCodeMetadata>"} */
|
|
93
|
+
/**
|
|
94
|
+
* Complete error taxonomy with metadata for each error code
|
|
95
|
+
* Maps error codes to their handling characteristics
|
|
96
|
+
*/
|
|
97
|
+
export const ERROR_TAXONOMY = {
|
|
98
|
+
// ========== Loader Errors ==========
|
|
99
|
+
[RouterErrorCode.LOADER_EXECUTION_ERROR]: {
|
|
100
|
+
code: RouterErrorCode.LOADER_EXECUTION_ERROR,
|
|
101
|
+
severity: ErrorSeverity.ERROR,
|
|
102
|
+
defaultStrategy: ErrorRecoveryStrategy.SHOW_ERROR_UI,
|
|
103
|
+
userMessage: 'Failed to load data for this page',
|
|
104
|
+
retryable: true,
|
|
105
|
+
},
|
|
106
|
+
[RouterErrorCode.LOADER_TIMEOUT]: {
|
|
107
|
+
code: RouterErrorCode.LOADER_TIMEOUT,
|
|
108
|
+
severity: ErrorSeverity.ERROR,
|
|
109
|
+
defaultStrategy: ErrorRecoveryStrategy.SHOW_ERROR_UI,
|
|
110
|
+
userMessage: 'Loading data took too long',
|
|
111
|
+
retryable: true,
|
|
112
|
+
},
|
|
113
|
+
[RouterErrorCode.LOADER_ABORTED]: {
|
|
114
|
+
code: RouterErrorCode.LOADER_ABORTED,
|
|
115
|
+
severity: ErrorSeverity.INFO,
|
|
116
|
+
defaultStrategy: ErrorRecoveryStrategy.SILENT_FAIL,
|
|
117
|
+
userMessage: 'Loading was cancelled',
|
|
118
|
+
retryable: false,
|
|
119
|
+
},
|
|
120
|
+
[RouterErrorCode.LOADER_FAILED_SENTINEL]: {
|
|
121
|
+
code: RouterErrorCode.LOADER_FAILED_SENTINEL,
|
|
122
|
+
severity: ErrorSeverity.ERROR,
|
|
123
|
+
defaultStrategy: ErrorRecoveryStrategy.SHOW_ERROR_UI,
|
|
124
|
+
userMessage: 'Failed to load data',
|
|
125
|
+
retryable: true,
|
|
126
|
+
},
|
|
127
|
+
// ========== Guard Errors ==========
|
|
128
|
+
[RouterErrorCode.GUARD_EXECUTION_ERROR]: {
|
|
129
|
+
code: RouterErrorCode.GUARD_EXECUTION_ERROR,
|
|
130
|
+
severity: ErrorSeverity.CRITICAL,
|
|
131
|
+
defaultStrategy: ErrorRecoveryStrategy.REDIRECT_FALLBACK,
|
|
132
|
+
userMessage: 'Navigation check failed',
|
|
133
|
+
retryable: false,
|
|
134
|
+
},
|
|
135
|
+
[RouterErrorCode.GUARD_TIMEOUT]: {
|
|
136
|
+
code: RouterErrorCode.GUARD_TIMEOUT,
|
|
137
|
+
severity: ErrorSeverity.ERROR,
|
|
138
|
+
defaultStrategy: ErrorRecoveryStrategy.REDIRECT_FALLBACK,
|
|
139
|
+
userMessage: 'Navigation check took too long',
|
|
140
|
+
retryable: true,
|
|
141
|
+
},
|
|
142
|
+
[RouterErrorCode.GUARD_ABORTED]: {
|
|
143
|
+
code: RouterErrorCode.GUARD_ABORTED,
|
|
144
|
+
severity: ErrorSeverity.INFO,
|
|
145
|
+
defaultStrategy: ErrorRecoveryStrategy.SILENT_FAIL,
|
|
146
|
+
userMessage: 'Navigation was cancelled',
|
|
147
|
+
retryable: false,
|
|
148
|
+
},
|
|
149
|
+
[RouterErrorCode.GUARD_DENIED]: {
|
|
150
|
+
code: RouterErrorCode.GUARD_DENIED,
|
|
151
|
+
severity: ErrorSeverity.WARNING,
|
|
152
|
+
defaultStrategy: ErrorRecoveryStrategy.SILENT_FAIL,
|
|
153
|
+
userMessage: "You don't have permission to access this page",
|
|
154
|
+
retryable: false,
|
|
155
|
+
},
|
|
156
|
+
// ========== Component Errors ==========
|
|
157
|
+
[RouterErrorCode.COMPONENT_FACTORY_ERROR]: {
|
|
158
|
+
code: RouterErrorCode.COMPONENT_FACTORY_ERROR,
|
|
159
|
+
severity: ErrorSeverity.ERROR,
|
|
160
|
+
defaultStrategy: ErrorRecoveryStrategy.SHOW_ERROR_UI,
|
|
161
|
+
userMessage: 'Failed to initialize page component',
|
|
162
|
+
retryable: true,
|
|
163
|
+
},
|
|
164
|
+
[RouterErrorCode.COMPONENT_RENDER_ERROR]: {
|
|
165
|
+
code: RouterErrorCode.COMPONENT_RENDER_ERROR,
|
|
166
|
+
severity: ErrorSeverity.ERROR,
|
|
167
|
+
defaultStrategy: ErrorRecoveryStrategy.SHOW_ERROR_UI,
|
|
168
|
+
userMessage: 'Failed to render page',
|
|
169
|
+
retryable: true,
|
|
170
|
+
},
|
|
171
|
+
[RouterErrorCode.COMPONENT_LOAD_ERROR]: {
|
|
172
|
+
code: RouterErrorCode.COMPONENT_LOAD_ERROR,
|
|
173
|
+
severity: ErrorSeverity.ERROR,
|
|
174
|
+
defaultStrategy: ErrorRecoveryStrategy.SHOW_ERROR_UI,
|
|
175
|
+
userMessage: 'Failed to load page component',
|
|
176
|
+
retryable: true,
|
|
177
|
+
},
|
|
178
|
+
[RouterErrorCode.COMPONENT_LIFECYCLE_ERROR]: {
|
|
179
|
+
code: RouterErrorCode.COMPONENT_LIFECYCLE_ERROR,
|
|
180
|
+
severity: ErrorSeverity.ERROR,
|
|
181
|
+
defaultStrategy: ErrorRecoveryStrategy.SHOW_ERROR_UI,
|
|
182
|
+
userMessage: 'Page component error',
|
|
183
|
+
retryable: true,
|
|
184
|
+
},
|
|
185
|
+
// ========== Navigation Errors ==========
|
|
186
|
+
[RouterErrorCode.ROUTE_NOT_FOUND]: {
|
|
187
|
+
code: RouterErrorCode.ROUTE_NOT_FOUND,
|
|
188
|
+
severity: ErrorSeverity.ERROR,
|
|
189
|
+
defaultStrategy: ErrorRecoveryStrategy.REDIRECT_FALLBACK,
|
|
190
|
+
userMessage: 'Page not found',
|
|
191
|
+
retryable: false,
|
|
192
|
+
},
|
|
193
|
+
[RouterErrorCode.NAVIGATION_ABORTED]: {
|
|
194
|
+
code: RouterErrorCode.NAVIGATION_ABORTED,
|
|
195
|
+
severity: ErrorSeverity.INFO,
|
|
196
|
+
defaultStrategy: ErrorRecoveryStrategy.SILENT_FAIL,
|
|
197
|
+
userMessage: 'Navigation was cancelled',
|
|
198
|
+
retryable: false,
|
|
199
|
+
},
|
|
200
|
+
[RouterErrorCode.NAVIGATION_SUPERSEDED]: {
|
|
201
|
+
code: RouterErrorCode.NAVIGATION_SUPERSEDED,
|
|
202
|
+
severity: ErrorSeverity.INFO,
|
|
203
|
+
defaultStrategy: ErrorRecoveryStrategy.SILENT_FAIL,
|
|
204
|
+
userMessage: 'Navigation was replaced by a newer navigation',
|
|
205
|
+
retryable: false,
|
|
206
|
+
},
|
|
207
|
+
[RouterErrorCode.CIRCULAR_REDIRECT]: {
|
|
208
|
+
code: RouterErrorCode.CIRCULAR_REDIRECT,
|
|
209
|
+
severity: ErrorSeverity.CRITICAL,
|
|
210
|
+
defaultStrategy: ErrorRecoveryStrategy.SHOW_ERROR_UI,
|
|
211
|
+
userMessage: 'Circular redirect detected',
|
|
212
|
+
retryable: false,
|
|
213
|
+
},
|
|
214
|
+
// ========== Error Boundary Errors ==========
|
|
215
|
+
[RouterErrorCode.ERROR_BOUNDARY_LOAD_ERROR]: {
|
|
216
|
+
code: RouterErrorCode.ERROR_BOUNDARY_LOAD_ERROR,
|
|
217
|
+
severity: ErrorSeverity.CRITICAL,
|
|
218
|
+
defaultStrategy: ErrorRecoveryStrategy.BUBBLE_UP,
|
|
219
|
+
userMessage: 'Failed to load error page',
|
|
220
|
+
retryable: false,
|
|
221
|
+
},
|
|
222
|
+
[RouterErrorCode.ERROR_BOUNDARY_RENDER_ERROR]: {
|
|
223
|
+
code: RouterErrorCode.ERROR_BOUNDARY_RENDER_ERROR,
|
|
224
|
+
severity: ErrorSeverity.CRITICAL,
|
|
225
|
+
defaultStrategy: ErrorRecoveryStrategy.BUBBLE_UP,
|
|
226
|
+
userMessage: 'Error page failed to render',
|
|
227
|
+
retryable: false,
|
|
228
|
+
},
|
|
229
|
+
// ========== Unknown/Generic ==========
|
|
230
|
+
[RouterErrorCode.UNKNOWN_ERROR]: {
|
|
231
|
+
code: RouterErrorCode.UNKNOWN_ERROR,
|
|
232
|
+
severity: ErrorSeverity.ERROR,
|
|
233
|
+
defaultStrategy: ErrorRecoveryStrategy.SHOW_ERROR_UI,
|
|
234
|
+
userMessage: 'An unexpected error occurred',
|
|
235
|
+
retryable: true,
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
/** @codexApi {"parent":"pithy.router.error-codes","name":"getErrorMetadata","stability":"stable","signature":"(code: RouterErrorCode) => ErrorCodeMetadata"} */
|
|
239
|
+
/**
|
|
240
|
+
* Get error metadata for a specific error code
|
|
241
|
+
* Provides severity, recovery strategy, and user message
|
|
242
|
+
* Used internally by RouterError instance methods
|
|
243
|
+
*/
|
|
244
|
+
export function getErrorMetadata(code) {
|
|
245
|
+
return ERROR_TAXONOMY[code] || ERROR_TAXONOMY[RouterErrorCode.UNKNOWN_ERROR];
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=error-codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../../../../src/router/features/errors/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,uIAAuI;AACvI;;;GAGG;AACH,MAAM,CAAN,IAAY,eAkDX;AAlDD,WAAY,eAAe;IACzB,6CAA6C;IAC7C,qCAAqC;IACrC,oEAAiD,CAAA;IACjD,uBAAuB;IACvB,oDAAiC,CAAA;IACjC,mCAAmC;IACnC,oDAAiC,CAAA;IACjC,6CAA6C;IAC7C,oEAAiD,CAAA;IAEjD,4CAA4C;IAC5C,oCAAoC;IACpC,kEAA+C,CAAA;IAC/C,sBAAsB;IACtB,kDAA+B,CAAA;IAC/B,kCAAkC;IAClC,kDAA+B,CAAA;IAC/B,+CAA+C;IAC/C,gDAA6B,CAAA;IAE7B,gDAAgD;IAChD,6CAA6C;IAC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aAAa,CAAC,QAAQ;QAChC,eAAe,EAAE,qBAAqB,CAAC,SAAS;QAChD,WAAW,EAAE,6BAA6B;QAC1C,SAAS,EAAE,KAAK;KACjB;IAED,wCAAwC;IACxC,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE;QAC/B,IAAI,EAAE,eAAe,CAAC,aAAa;QACnC,QAAQ,EAAE,aAAa,CAAC,KAAK;QAC7B,eAAe,EAAE,qBAAqB,CAAC,aAAa;QACpD,WAAW,EAAE,8BAA8B;QAC3C,SAAS,EAAE,IAAI;KAChB;CACF,CAAC;AAEF,gKAAgK;AAChK;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAqB;IACpD,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.router.error-resolution",
|
|
4
|
+
"title": "Error Component Resolution",
|
|
5
|
+
"category": "runtime"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
import type { RouteNode } from '../../core/types';
|
|
9
|
+
/** @codexApi {"parent":"pithy.router.error-resolution","name":"resolveErrorImport","stability":"internal","signature":"(node: RouteNode, getParent: (node: RouteNode) => RouteNode | undefined) => (() => Promise<unknown>) | null","description":"Resolve error component by walking parent chain"} */
|
|
10
|
+
/**
|
|
11
|
+
* Resolve error component import function by walking parent chain
|
|
12
|
+
* Returns the dynamic import function for the nearest error.ts in the route hierarchy.
|
|
13
|
+
* Error boundaries follow the parent chain until an error component is found.
|
|
14
|
+
*
|
|
15
|
+
* @param node - Current route node where error occurred
|
|
16
|
+
* @param getParent - Function to get parent node (from segment chain)
|
|
17
|
+
* @returns Dynamic import function for error component, or null if none found
|
|
18
|
+
* @internal Used internally by outlet manager for error boundary resolution
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveErrorImport(node: RouteNode, getParent: (node: RouteNode) => RouteNode | undefined): (() => Promise<unknown>) | null;
|
|
21
|
+
/** @codexApi {"parent":"pithy.router.error-resolution","name":"hasErrorComponent","stability":"internal","signature":"(node: RouteNode) => boolean","description":"Check if a route node has an error component"} */
|
|
22
|
+
/**
|
|
23
|
+
* Check if a route node has an error component
|
|
24
|
+
* Useful for determining if error boundaries are available at a route level.
|
|
25
|
+
*
|
|
26
|
+
* @param node - Route node to check
|
|
27
|
+
* @returns True if node has error.ts file
|
|
28
|
+
* @internal Used internally for error boundary presence checks
|
|
29
|
+
*/
|
|
30
|
+
export declare function hasErrorComponent(node: RouteNode): boolean;
|
|
31
|
+
//# sourceMappingURL=error-resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-resolution.d.ts","sourceRoot":"","sources":["../../../../src/router/features/errors/error-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,wSAAwS;AACxS;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,GACpD,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAkBjC;AAED,qNAAqN;AACrN;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAE1D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.router.error-resolution",
|
|
4
|
+
"title": "Error Component Resolution",
|
|
5
|
+
"category": "runtime"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
/** @codexApi {"parent":"pithy.router.error-resolution","name":"resolveErrorImport","stability":"internal","signature":"(node: RouteNode, getParent: (node: RouteNode) => RouteNode | undefined) => (() => Promise<unknown>) | null","description":"Resolve error component by walking parent chain"} */
|
|
9
|
+
/**
|
|
10
|
+
* Resolve error component import function by walking parent chain
|
|
11
|
+
* Returns the dynamic import function for the nearest error.ts in the route hierarchy.
|
|
12
|
+
* Error boundaries follow the parent chain until an error component is found.
|
|
13
|
+
*
|
|
14
|
+
* @param node - Current route node where error occurred
|
|
15
|
+
* @param getParent - Function to get parent node (from segment chain)
|
|
16
|
+
* @returns Dynamic import function for error component, or null if none found
|
|
17
|
+
* @internal Used internally by outlet manager for error boundary resolution
|
|
18
|
+
*/
|
|
19
|
+
export function resolveErrorImport(node, getParent) {
|
|
20
|
+
let current = node;
|
|
21
|
+
const visited = new Set();
|
|
22
|
+
while (current) {
|
|
23
|
+
// Prevent infinite loops from circular parent chains
|
|
24
|
+
if (visited.has(current)) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
visited.add(current);
|
|
28
|
+
if (current.imports.error) {
|
|
29
|
+
return current.imports.error;
|
|
30
|
+
}
|
|
31
|
+
current = getParent(current);
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
/** @codexApi {"parent":"pithy.router.error-resolution","name":"hasErrorComponent","stability":"internal","signature":"(node: RouteNode) => boolean","description":"Check if a route node has an error component"} */
|
|
36
|
+
/**
|
|
37
|
+
* Check if a route node has an error component
|
|
38
|
+
* Useful for determining if error boundaries are available at a route level.
|
|
39
|
+
*
|
|
40
|
+
* @param node - Route node to check
|
|
41
|
+
* @returns True if node has error.ts file
|
|
42
|
+
* @internal Used internally for error boundary presence checks
|
|
43
|
+
*/
|
|
44
|
+
export function hasErrorComponent(node) {
|
|
45
|
+
return !!node.imports.error;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=error-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-resolution.js","sourceRoot":"","sources":["../../../../src/router/features/errors/error-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAIF,wSAAwS;AACxS;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAe,EACf,SAAqD;IAErD,IAAI,OAAO,GAA0B,IAAI,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAa,CAAC;IAErC,OAAO,OAAO,EAAE,CAAC;QACf,qDAAqD;QACrD,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAErB,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC1B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;QAC/B,CAAC;QACD,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,qNAAqN;AACrN;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAe;IAC/C,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.router.error-types",
|
|
4
|
+
"title": "Router Error Type Definitions",
|
|
5
|
+
"category": "types"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
import { RouterErrorCode } from './error-codes';
|
|
9
|
+
export { RouterErrorCode } from './error-codes';
|
|
10
|
+
/** @codexApi {"parent":"pithy.router.error-types","name":"ErrorContext","stability":"stable","signature":"type ErrorContext"} */
|
|
11
|
+
/**
|
|
12
|
+
* Context information for router errors
|
|
13
|
+
* Includes navigation tracking and route identification for precise error reporting
|
|
14
|
+
*/
|
|
15
|
+
export type ErrorContext = {
|
|
16
|
+
/** Navigation ID when error occurred */
|
|
17
|
+
navId: string;
|
|
18
|
+
/** Route ID where error occurred */
|
|
19
|
+
routeId: string;
|
|
20
|
+
/** Parent route ID for error resolution */
|
|
21
|
+
parentRouteId?: string | undefined;
|
|
22
|
+
/** Route path where error occurred */
|
|
23
|
+
routePath: string;
|
|
24
|
+
/** Canonical error code for deterministic handling */
|
|
25
|
+
code?: RouterErrorCode;
|
|
26
|
+
/** Timestamp when error occurred */
|
|
27
|
+
ts: number;
|
|
28
|
+
};
|
|
29
|
+
/** @codexApi {"parent":"pithy.router.error-types","name":"RouterError","stability":"stable","signature":"class RouterError extends Error"} */
|
|
30
|
+
/**
|
|
31
|
+
* Router-specific error class with context
|
|
32
|
+
* Extends native Error with routing metadata for enhanced error tracking.
|
|
33
|
+
* Use this when throwing errors in guards, loaders, or route components.
|
|
34
|
+
*/
|
|
35
|
+
export declare class RouterError extends Error {
|
|
36
|
+
/** Error context with navigation and route info */
|
|
37
|
+
ctx: ErrorContext;
|
|
38
|
+
/** Original error cause if wrapped */
|
|
39
|
+
cause?: unknown;
|
|
40
|
+
/** Canonical error code for deterministic handling */
|
|
41
|
+
code: RouterErrorCode;
|
|
42
|
+
constructor(message: string, ctx: ErrorContext, cause?: unknown, code?: RouterErrorCode);
|
|
43
|
+
/**
|
|
44
|
+
* Check if this error is retryable
|
|
45
|
+
*/
|
|
46
|
+
isRetryable(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Get user-friendly error message
|
|
49
|
+
*/
|
|
50
|
+
getUserMessage(): string;
|
|
51
|
+
/**
|
|
52
|
+
* Get error severity
|
|
53
|
+
*/
|
|
54
|
+
getSeverity(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Get recommended recovery strategy
|
|
57
|
+
*/
|
|
58
|
+
getRecoveryStrategy(): string;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=error-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-types.d.ts","sourceRoot":"","sources":["../../../../src/router/features/errors/error-types.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,eAAe,EAAoB,MAAM,eAAe,CAAC;AAGlE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,iIAAiI;AACjI;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,8IAA8I;AAC9I;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,mDAAmD;IACnD,GAAG,EAAE,YAAY,CAAC;IAClB,sCAAsC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sDAAsD;IACtD,IAAI,EAAE,eAAe,CAAC;gBAGpB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,YAAY,EACjB,KAAK,CAAC,EAAE,OAAO,EACf,IAAI,GAAE,eAA+C;IAkBvD;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,mBAAmB,IAAI,MAAM;CAG9B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.router.error-types",
|
|
4
|
+
"title": "Router Error Type Definitions",
|
|
5
|
+
"category": "types"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
import { RouterErrorCode, getErrorMetadata } from './error-codes';
|
|
9
|
+
// Re-export error codes for convenience
|
|
10
|
+
export { RouterErrorCode } from './error-codes';
|
|
11
|
+
/** @codexApi {"parent":"pithy.router.error-types","name":"RouterError","stability":"stable","signature":"class RouterError extends Error"} */
|
|
12
|
+
/**
|
|
13
|
+
* Router-specific error class with context
|
|
14
|
+
* Extends native Error with routing metadata for enhanced error tracking.
|
|
15
|
+
* Use this when throwing errors in guards, loaders, or route components.
|
|
16
|
+
*/
|
|
17
|
+
export class RouterError extends Error {
|
|
18
|
+
constructor(message, ctx, cause, code = RouterErrorCode.UNKNOWN_ERROR) {
|
|
19
|
+
// Use user-friendly message from taxonomy if available
|
|
20
|
+
const metadata = getErrorMetadata(code);
|
|
21
|
+
const userMessage = message || metadata.userMessage;
|
|
22
|
+
super(userMessage);
|
|
23
|
+
this.name = 'RouterError';
|
|
24
|
+
this.ctx = { ...ctx, code };
|
|
25
|
+
this.cause = cause;
|
|
26
|
+
this.code = code;
|
|
27
|
+
// Maintain proper stack trace in V8
|
|
28
|
+
if (Error.captureStackTrace) {
|
|
29
|
+
Error.captureStackTrace(this, RouterError);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if this error is retryable
|
|
34
|
+
*/
|
|
35
|
+
isRetryable() {
|
|
36
|
+
return getErrorMetadata(this.code).retryable;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get user-friendly error message
|
|
40
|
+
*/
|
|
41
|
+
getUserMessage() {
|
|
42
|
+
return getErrorMetadata(this.code).userMessage;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get error severity
|
|
46
|
+
*/
|
|
47
|
+
getSeverity() {
|
|
48
|
+
return getErrorMetadata(this.code).severity;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get recommended recovery strategy
|
|
52
|
+
*/
|
|
53
|
+
getRecoveryStrategy() {
|
|
54
|
+
return getErrorMetadata(this.code).defaultStrategy;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=error-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.router.error-fallback",
|
|
4
|
+
"title": "Global Error Fallback Component",
|
|
5
|
+
"category": "runtime"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
import type { RouterError } from './error-types';
|
|
9
|
+
/** @codexApi {"parent":"pithy.router.error-fallback","name":"ErrorComponentProps","stability":"stable","signature":"interface ErrorComponentProps","description":"Props passed to error boundary components"} */
|
|
10
|
+
/**
|
|
11
|
+
* Props interface for error components
|
|
12
|
+
* Passed to both custom error.ts and global fallback
|
|
13
|
+
*/
|
|
14
|
+
export interface ErrorComponentProps {
|
|
15
|
+
/** The error that occurred (may be a plain Error or a RouterError) */
|
|
16
|
+
error: Error & Partial<RouterError>;
|
|
17
|
+
/** Function to retry the failed operation */
|
|
18
|
+
retry: () => void;
|
|
19
|
+
}
|
|
20
|
+
/** @codexApi {"parent":"pithy.router.error-fallback","name":"GlobalErrorFallback","stability":"stable","signature":"(props: ErrorComponentProps) => Component","description":"Default error UI when no route-specific error.ts exists"} */
|
|
21
|
+
/**
|
|
22
|
+
* Global fallback error component
|
|
23
|
+
* Shown when no route-specific error.ts exists
|
|
24
|
+
* Provides basic error display with retry button
|
|
25
|
+
*
|
|
26
|
+
* @param props - Error component props
|
|
27
|
+
* @returns PithyJS component instance
|
|
28
|
+
*/
|
|
29
|
+
export declare function GlobalErrorFallback({ error, retry }: ErrorComponentProps): {
|
|
30
|
+
el: HTMLElement | DocumentFragment;
|
|
31
|
+
destroy: () => void;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=global-error-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-error-fallback.d.ts","sourceRoot":"","sources":["../../../../src/router/features/errors/global-error-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAGF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,iNAAiN;AACjN;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,6CAA6C;IAC7C,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,2OAA2O;AAC3O;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,mBAAmB;;;EA6KxE"}
|