@stacksjs/error-handling 0.70.73 → 0.70.75
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/dist/error-page-styles.d.ts +1 -620
- package/dist/error-page-template.d.ts +1 -33
- package/dist/error-page.d.ts +107 -115
- package/dist/handler.d.ts +1 -1
- package/dist/handler.js +8 -8
- package/package.json +7 -7
|
@@ -2,623 +2,4 @@
|
|
|
2
2
|
* Laravel-style error page styles (v12.29+ local debug page).
|
|
3
3
|
* Inline CSS — no external dependencies.
|
|
4
4
|
*/
|
|
5
|
-
export declare const ERROR_PAGE_CSS:
|
|
6
|
-
:root {
|
|
7
|
-
--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
8
|
-
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
9
|
-
--neutral-50: #fafafa;
|
|
10
|
-
--neutral-100: #f5f5f5;
|
|
11
|
-
--neutral-200: #e5e5e5;
|
|
12
|
-
--neutral-300: #d4d4d4;
|
|
13
|
-
--neutral-400: #a3a3a3;
|
|
14
|
-
--neutral-500: #737373;
|
|
15
|
-
--neutral-600: #525252;
|
|
16
|
-
--neutral-700: #404040;
|
|
17
|
-
--neutral-800: #262626;
|
|
18
|
-
--neutral-900: #171717;
|
|
19
|
-
--neutral-950: #0a0a0a;
|
|
20
|
-
--rose-100: #ffe4e6;
|
|
21
|
-
--rose-200: #fecdd3;
|
|
22
|
-
--rose-500: #f43f5e;
|
|
23
|
-
--rose-600: #e11d48;
|
|
24
|
-
--rose-900: #881337;
|
|
25
|
-
--rose-950: #4c0519;
|
|
26
|
-
--blue-100: #dbeafe;
|
|
27
|
-
--blue-500: #3b82f6;
|
|
28
|
-
--blue-600: #2563eb;
|
|
29
|
-
--blue-700: #1d4ed8;
|
|
30
|
-
--blue-900: #1e3a8a;
|
|
31
|
-
--emerald-500: #10b981;
|
|
32
|
-
--amber-200: #fde68a;
|
|
33
|
-
--amber-600: #d97706;
|
|
34
|
-
--amber-900: #78350f;
|
|
35
|
-
--white: #fff;
|
|
36
|
-
--radius-md: 0.375rem;
|
|
37
|
-
--radius-lg: 0.5rem;
|
|
38
|
-
--radius-xl: 0.75rem;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
42
|
-
|
|
43
|
-
html {
|
|
44
|
-
-webkit-text-size-adjust: 100%;
|
|
45
|
-
color-scheme: light dark;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
body {
|
|
49
|
-
font-family: var(--font-sans);
|
|
50
|
-
-webkit-font-smoothing: antialiased;
|
|
51
|
-
-moz-osx-font-smoothing: grayscale;
|
|
52
|
-
background: var(--neutral-50);
|
|
53
|
-
color: var(--neutral-950);
|
|
54
|
-
line-height: 1.5;
|
|
55
|
-
min-height: 100dvh;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@media (prefers-color-scheme: dark) {
|
|
59
|
-
body {
|
|
60
|
-
background: var(--neutral-900);
|
|
61
|
-
color: var(--white);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.page {
|
|
66
|
-
max-width: 80rem;
|
|
67
|
-
margin: 0 auto;
|
|
68
|
-
padding: 3.5rem 1.5rem 2rem;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@media (min-width: 640px) {
|
|
72
|
-
.page { padding: 4rem 3.5rem 2rem; }
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/* ── Header ── */
|
|
76
|
-
.header {
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
justify-content: space-between;
|
|
80
|
-
gap: 1rem;
|
|
81
|
-
margin-bottom: 2rem;
|
|
82
|
-
flex-wrap: wrap;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.header-title {
|
|
86
|
-
display: flex;
|
|
87
|
-
align-items: center;
|
|
88
|
-
gap: 0.625rem;
|
|
89
|
-
font-size: 0.875rem;
|
|
90
|
-
font-weight: 500;
|
|
91
|
-
color: var(--neutral-600);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@media (prefers-color-scheme: dark) {
|
|
95
|
-
.header-title { color: var(--neutral-400); }
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.header-dot {
|
|
99
|
-
width: 0.625rem;
|
|
100
|
-
height: 0.625rem;
|
|
101
|
-
border-radius: 9999px;
|
|
102
|
-
background: var(--rose-500);
|
|
103
|
-
flex-shrink: 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.btn-copy {
|
|
107
|
-
display: inline-flex;
|
|
108
|
-
align-items: center;
|
|
109
|
-
gap: 0.375rem;
|
|
110
|
-
padding: 0.375rem 0.75rem;
|
|
111
|
-
font-size: 0.75rem;
|
|
112
|
-
font-weight: 500;
|
|
113
|
-
border: 1px solid var(--neutral-200);
|
|
114
|
-
border-radius: var(--radius-md);
|
|
115
|
-
background: var(--white);
|
|
116
|
-
color: var(--neutral-700);
|
|
117
|
-
cursor: pointer;
|
|
118
|
-
transition: background 0.15s, border-color 0.15s;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.btn-copy:hover { background: var(--neutral-100); }
|
|
122
|
-
.btn-copy.copied { border-color: var(--emerald-500); color: var(--emerald-500); }
|
|
123
|
-
|
|
124
|
-
@media (prefers-color-scheme: dark) {
|
|
125
|
-
.btn-copy {
|
|
126
|
-
background: var(--neutral-800);
|
|
127
|
-
border-color: rgba(255,255,255,0.1);
|
|
128
|
-
color: var(--neutral-200);
|
|
129
|
-
}
|
|
130
|
-
.btn-copy:hover { background: rgba(255,255,255,0.05); }
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/* ── Error summary card ── */
|
|
134
|
-
.summary {
|
|
135
|
-
margin-bottom: 2rem;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.summary h1 {
|
|
139
|
-
font-size: 1.875rem;
|
|
140
|
-
font-weight: 600;
|
|
141
|
-
line-height: 1.2;
|
|
142
|
-
margin-bottom: 0.75rem;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.summary-file {
|
|
146
|
-
font-family: var(--font-mono);
|
|
147
|
-
font-size: 0.875rem;
|
|
148
|
-
color: var(--rose-600);
|
|
149
|
-
margin-bottom: 0.75rem;
|
|
150
|
-
word-break: break-all;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
@media (prefers-color-scheme: dark) {
|
|
154
|
-
.summary-file { color: var(--rose-500); }
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.summary-message {
|
|
158
|
-
font-size: 1.125rem;
|
|
159
|
-
color: var(--neutral-800);
|
|
160
|
-
margin-bottom: 1.25rem;
|
|
161
|
-
word-break: break-word;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
@media (prefers-color-scheme: dark) {
|
|
165
|
-
.summary-message { color: var(--neutral-200); }
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.badges {
|
|
169
|
-
display: flex;
|
|
170
|
-
flex-wrap: wrap;
|
|
171
|
-
gap: 0.5rem;
|
|
172
|
-
margin-bottom: 1.25rem;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.badge {
|
|
176
|
-
display: inline-flex;
|
|
177
|
-
align-items: center;
|
|
178
|
-
padding: 0.25rem 0.5rem;
|
|
179
|
-
font-size: 0.6875rem;
|
|
180
|
-
font-weight: 600;
|
|
181
|
-
letter-spacing: 0.04em;
|
|
182
|
-
text-transform: uppercase;
|
|
183
|
-
border-radius: var(--radius-md);
|
|
184
|
-
border: 1px solid var(--neutral-200);
|
|
185
|
-
background: var(--neutral-100);
|
|
186
|
-
color: var(--neutral-600);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
@media (prefers-color-scheme: dark) {
|
|
190
|
-
.badge {
|
|
191
|
-
border-color: rgba(255,255,255,0.1);
|
|
192
|
-
background: rgba(255,255,255,0.05);
|
|
193
|
-
color: var(--neutral-400);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.badge-status {
|
|
198
|
-
background: var(--rose-100);
|
|
199
|
-
border-color: var(--rose-200);
|
|
200
|
-
color: var(--rose-900);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
@media (prefers-color-scheme: dark) {
|
|
204
|
-
.badge-status {
|
|
205
|
-
background: var(--rose-950);
|
|
206
|
-
border-color: var(--rose-900);
|
|
207
|
-
color: var(--rose-100);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.request-row {
|
|
212
|
-
display: flex;
|
|
213
|
-
align-items: center;
|
|
214
|
-
gap: 0.75rem;
|
|
215
|
-
flex-wrap: wrap;
|
|
216
|
-
font-size: 0.875rem;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.badge-method {
|
|
220
|
-
background: var(--blue-100);
|
|
221
|
-
border-color: transparent;
|
|
222
|
-
color: var(--blue-900);
|
|
223
|
-
font-family: var(--font-mono);
|
|
224
|
-
font-size: 0.6875rem;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
@media (prefers-color-scheme: dark) {
|
|
228
|
-
.badge-method {
|
|
229
|
-
background: var(--blue-700);
|
|
230
|
-
color: var(--white);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.request-url {
|
|
235
|
-
font-family: var(--font-mono);
|
|
236
|
-
font-size: 0.8125rem;
|
|
237
|
-
color: var(--neutral-500);
|
|
238
|
-
word-break: break-all;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
@media (prefers-color-scheme: dark) {
|
|
242
|
-
.request-url { color: var(--neutral-400); }
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/* ── Hints ── */
|
|
246
|
-
.hints {
|
|
247
|
-
border: 1px solid var(--amber-200);
|
|
248
|
-
border-radius: var(--radius-lg);
|
|
249
|
-
background: #fffbeb;
|
|
250
|
-
margin-bottom: 2rem;
|
|
251
|
-
overflow: hidden;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
@media (prefers-color-scheme: dark) {
|
|
255
|
-
.hints {
|
|
256
|
-
border-color: var(--amber-600);
|
|
257
|
-
background: rgba(120, 53, 15, 0.3);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.hints-header {
|
|
262
|
-
padding: 0.75rem 1rem;
|
|
263
|
-
font-size: 0.8125rem;
|
|
264
|
-
font-weight: 600;
|
|
265
|
-
color: var(--amber-900);
|
|
266
|
-
border-bottom: 1px solid var(--amber-200);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
@media (prefers-color-scheme: dark) {
|
|
270
|
-
.hints-header { color: var(--amber-200); border-bottom-color: rgba(217,119,6,0.3); }
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.hints-body {
|
|
274
|
-
padding: 1rem;
|
|
275
|
-
font-size: 0.875rem;
|
|
276
|
-
color: var(--neutral-700);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
@media (prefers-color-scheme: dark) {
|
|
280
|
-
.hints-body { color: var(--neutral-300); }
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.hints-body ul { margin: 0 0 0.75rem 1.25rem; }
|
|
284
|
-
.hints-body li { margin: 0.2rem 0; }
|
|
285
|
-
.hints-suggestion { font-weight: 500; margin-bottom: 0.5rem; }
|
|
286
|
-
.hints-doc { color: var(--blue-600); text-decoration: none; font-size: 0.8125rem; }
|
|
287
|
-
.hints-doc:hover { text-decoration: underline; }
|
|
288
|
-
|
|
289
|
-
/* ── Exception trace ── */
|
|
290
|
-
.trace {
|
|
291
|
-
margin-bottom: 2rem;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.trace-title {
|
|
295
|
-
font-size: 0.875rem;
|
|
296
|
-
font-weight: 600;
|
|
297
|
-
color: var(--neutral-500);
|
|
298
|
-
text-transform: uppercase;
|
|
299
|
-
letter-spacing: 0.05em;
|
|
300
|
-
margin-bottom: 1rem;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
@media (prefers-color-scheme: dark) {
|
|
304
|
-
.trace-title { color: var(--neutral-400); }
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.trace-frame {
|
|
308
|
-
border: 1px solid var(--neutral-200);
|
|
309
|
-
border-radius: var(--radius-lg);
|
|
310
|
-
margin-bottom: 0.5rem;
|
|
311
|
-
overflow: hidden;
|
|
312
|
-
background: var(--white);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
@media (prefers-color-scheme: dark) {
|
|
316
|
-
.trace-frame {
|
|
317
|
-
border-color: rgba(255,255,255,0.1);
|
|
318
|
-
background: rgba(255,255,255,0.02);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
.trace-frame-header {
|
|
323
|
-
display: flex;
|
|
324
|
-
align-items: baseline;
|
|
325
|
-
gap: 0.5rem;
|
|
326
|
-
padding: 0.75rem 1rem;
|
|
327
|
-
cursor: pointer;
|
|
328
|
-
font-size: 0.8125rem;
|
|
329
|
-
transition: background 0.15s;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.trace-frame-header:hover { background: var(--neutral-50); }
|
|
333
|
-
|
|
334
|
-
@media (prefers-color-scheme: dark) {
|
|
335
|
-
.trace-frame-header:hover { background: rgba(255,255,255,0.03); }
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.trace-frame-fn {
|
|
339
|
-
font-family: var(--font-mono);
|
|
340
|
-
color: var(--neutral-800);
|
|
341
|
-
flex: 1;
|
|
342
|
-
min-width: 0;
|
|
343
|
-
overflow: hidden;
|
|
344
|
-
text-overflow: ellipsis;
|
|
345
|
-
white-space: nowrap;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
@media (prefers-color-scheme: dark) {
|
|
349
|
-
.trace-frame-fn { color: var(--neutral-200); }
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.trace-frame-file {
|
|
353
|
-
font-family: var(--font-mono);
|
|
354
|
-
font-size: 0.75rem;
|
|
355
|
-
color: var(--neutral-400);
|
|
356
|
-
flex-shrink: 0;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
.trace-frame-body {
|
|
360
|
-
display: none;
|
|
361
|
-
border-top: 1px solid var(--neutral-200);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.trace-frame.expanded .trace-frame-body { display: block; }
|
|
365
|
-
|
|
366
|
-
@media (prefers-color-scheme: dark) {
|
|
367
|
-
.trace-frame-body { border-top-color: rgba(255,255,255,0.08); }
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
.trace-vendor {
|
|
371
|
-
border: 1px dashed var(--neutral-300);
|
|
372
|
-
border-radius: var(--radius-lg);
|
|
373
|
-
margin-bottom: 0.5rem;
|
|
374
|
-
overflow: hidden;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
@media (prefers-color-scheme: dark) {
|
|
378
|
-
.trace-vendor { border-color: rgba(255,255,255,0.15); }
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
.trace-vendor-toggle {
|
|
382
|
-
display: flex;
|
|
383
|
-
align-items: center;
|
|
384
|
-
gap: 0.5rem;
|
|
385
|
-
padding: 0.75rem 1rem;
|
|
386
|
-
font-size: 0.8125rem;
|
|
387
|
-
font-weight: 500;
|
|
388
|
-
color: var(--neutral-500);
|
|
389
|
-
cursor: pointer;
|
|
390
|
-
background: var(--neutral-50);
|
|
391
|
-
transition: background 0.15s;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
.trace-vendor-toggle:hover { background: var(--neutral-100); }
|
|
395
|
-
|
|
396
|
-
@media (prefers-color-scheme: dark) {
|
|
397
|
-
.trace-vendor-toggle {
|
|
398
|
-
background: rgba(255,255,255,0.03);
|
|
399
|
-
color: var(--neutral-400);
|
|
400
|
-
}
|
|
401
|
-
.trace-vendor-toggle:hover { background: rgba(255,255,255,0.05); }
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.trace-vendor-frames { display: none; padding: 0.25rem 0; }
|
|
405
|
-
.trace-vendor.expanded .trace-vendor-frames { display: block; }
|
|
406
|
-
|
|
407
|
-
/* ── Code snippet ── */
|
|
408
|
-
.code-block {
|
|
409
|
-
overflow-x: auto;
|
|
410
|
-
font-family: var(--font-mono);
|
|
411
|
-
font-size: 0.8125rem;
|
|
412
|
-
line-height: 1.6;
|
|
413
|
-
background: var(--neutral-950);
|
|
414
|
-
color: #abb2bf;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
.code-line {
|
|
418
|
-
display: flex;
|
|
419
|
-
min-height: 1.5rem;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
.code-line:nth-child(odd) { background: rgba(255,255,255,0.02); }
|
|
423
|
-
.code-line:nth-child(even) { background: rgba(255,255,255,0.04); }
|
|
424
|
-
|
|
425
|
-
.code-line.highlight {
|
|
426
|
-
background: rgba(244, 63, 94, 0.25) !important;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
.code-ln {
|
|
430
|
-
width: 3.5rem;
|
|
431
|
-
text-align: right;
|
|
432
|
-
padding: 0 1rem 0 0.5rem;
|
|
433
|
-
color: var(--neutral-500);
|
|
434
|
-
user-select: none;
|
|
435
|
-
flex-shrink: 0;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
.code-line.highlight .code-ln { color: var(--rose-500); }
|
|
439
|
-
|
|
440
|
-
.code-txt {
|
|
441
|
-
flex: 1;
|
|
442
|
-
padding-right: 1rem;
|
|
443
|
-
white-space: pre;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/* ── Context panels ── */
|
|
447
|
-
.context {
|
|
448
|
-
margin-bottom: 2rem;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
.context-tabs {
|
|
452
|
-
display: flex;
|
|
453
|
-
gap: 0;
|
|
454
|
-
border-bottom: 2px solid var(--neutral-200);
|
|
455
|
-
overflow-x: auto;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
@media (prefers-color-scheme: dark) {
|
|
459
|
-
.context-tabs { border-bottom-color: rgba(255,255,255,0.1); }
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.context-tab {
|
|
463
|
-
padding: 0.625rem 1rem;
|
|
464
|
-
font-size: 0.8125rem;
|
|
465
|
-
font-weight: 500;
|
|
466
|
-
color: var(--neutral-500);
|
|
467
|
-
background: none;
|
|
468
|
-
border: none;
|
|
469
|
-
border-bottom: 2px solid transparent;
|
|
470
|
-
margin-bottom: -2px;
|
|
471
|
-
cursor: pointer;
|
|
472
|
-
white-space: nowrap;
|
|
473
|
-
transition: color 0.15s;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
.context-tab:hover { color: var(--neutral-800); }
|
|
477
|
-
.context-tab.active {
|
|
478
|
-
color: var(--rose-600);
|
|
479
|
-
border-bottom-color: var(--rose-500);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
@media (prefers-color-scheme: dark) {
|
|
483
|
-
.context-tab:hover { color: var(--neutral-200); }
|
|
484
|
-
.context-tab.active { color: var(--rose-500); }
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
.context-panel {
|
|
488
|
-
display: none;
|
|
489
|
-
padding: 1.25rem 0;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
.context-panel.active { display: block; }
|
|
493
|
-
|
|
494
|
-
.kv-table {
|
|
495
|
-
width: 100%;
|
|
496
|
-
border-collapse: collapse;
|
|
497
|
-
font-size: 0.8125rem;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.kv-table tr {
|
|
501
|
-
border-bottom: 1px solid var(--neutral-100);
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
@media (prefers-color-scheme: dark) {
|
|
505
|
-
.kv-table tr { border-bottom-color: rgba(255,255,255,0.05); }
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
.kv-table td {
|
|
509
|
-
padding: 0.5rem 0.75rem;
|
|
510
|
-
vertical-align: top;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
.kv-table td:first-child {
|
|
514
|
-
font-weight: 500;
|
|
515
|
-
color: var(--neutral-500);
|
|
516
|
-
width: 30%;
|
|
517
|
-
font-family: var(--font-mono);
|
|
518
|
-
font-size: 0.75rem;
|
|
519
|
-
word-break: break-all;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
@media (prefers-color-scheme: dark) {
|
|
523
|
-
.kv-table td:first-child { color: var(--neutral-400); }
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
.kv-table td:last-child {
|
|
527
|
-
font-family: var(--font-mono);
|
|
528
|
-
font-size: 0.75rem;
|
|
529
|
-
word-break: break-all;
|
|
530
|
-
color: var(--neutral-800);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
@media (prefers-color-scheme: dark) {
|
|
534
|
-
.kv-table td:last-child { color: var(--neutral-200); }
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
.query-item {
|
|
538
|
-
padding: 0.75rem 1rem;
|
|
539
|
-
margin-bottom: 0.5rem;
|
|
540
|
-
border: 1px solid var(--neutral-200);
|
|
541
|
-
border-radius: var(--radius-md);
|
|
542
|
-
font-family: var(--font-mono);
|
|
543
|
-
font-size: 0.75rem;
|
|
544
|
-
background: var(--neutral-50);
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
@media (prefers-color-scheme: dark) {
|
|
548
|
-
.query-item {
|
|
549
|
-
border-color: rgba(255,255,255,0.08);
|
|
550
|
-
background: rgba(255,255,255,0.03);
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
.query-time {
|
|
555
|
-
margin-top: 0.375rem;
|
|
556
|
-
font-size: 0.6875rem;
|
|
557
|
-
color: var(--neutral-400);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
.json-block {
|
|
561
|
-
font-family: var(--font-mono);
|
|
562
|
-
font-size: 0.75rem;
|
|
563
|
-
background: var(--neutral-100);
|
|
564
|
-
border-radius: var(--radius-md);
|
|
565
|
-
padding: 1rem;
|
|
566
|
-
overflow-x: auto;
|
|
567
|
-
white-space: pre-wrap;
|
|
568
|
-
word-break: break-all;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
@media (prefers-color-scheme: dark) {
|
|
572
|
-
.json-block {
|
|
573
|
-
background: rgba(255,255,255,0.05);
|
|
574
|
-
color: var(--neutral-200);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
/* ── Production page ── */
|
|
579
|
-
.production-page {
|
|
580
|
-
display: flex;
|
|
581
|
-
flex-direction: column;
|
|
582
|
-
align-items: center;
|
|
583
|
-
justify-content: center;
|
|
584
|
-
min-height: 100dvh;
|
|
585
|
-
text-align: center;
|
|
586
|
-
padding: 2rem;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
.production-status {
|
|
590
|
-
font-size: 6rem;
|
|
591
|
-
font-weight: 700;
|
|
592
|
-
color: var(--neutral-200);
|
|
593
|
-
margin-bottom: 1rem;
|
|
594
|
-
line-height: 1;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
@media (prefers-color-scheme: dark) {
|
|
598
|
-
.production-status { color: var(--neutral-700); }
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
.production-title {
|
|
602
|
-
font-size: 1.5rem;
|
|
603
|
-
font-weight: 600;
|
|
604
|
-
margin-bottom: 0.5rem;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
.production-message {
|
|
608
|
-
color: var(--neutral-500);
|
|
609
|
-
margin-bottom: 2rem;
|
|
610
|
-
max-width: 28rem;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
.production-link {
|
|
614
|
-
color: var(--blue-600);
|
|
615
|
-
text-decoration: none;
|
|
616
|
-
font-size: 0.875rem;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
.production-link:hover { text-decoration: underline; }
|
|
620
|
-
|
|
621
|
-
@media (prefers-color-scheme: dark) {
|
|
622
|
-
.production-link { color: var(--blue-500); }
|
|
623
|
-
}
|
|
624
|
-
`;
|
|
5
|
+
export declare const ERROR_PAGE_CSS: string;
|
|
@@ -30,39 +30,7 @@ export declare function buildErrorMarkdown(opts: {
|
|
|
30
30
|
frames: ParsedFrame[]
|
|
31
31
|
}): string;
|
|
32
32
|
export declare function wrapErrorPage(body: string, markdown: string): string;
|
|
33
|
-
export declare const ERROR_PAGE_SCRIPT:
|
|
34
|
-
function initErrorPage() {
|
|
35
|
-
const copyBtn = document.getElementById('copy-markdown');
|
|
36
|
-
const markdown = document.getElementById('error-markdown');
|
|
37
|
-
if (copyBtn && markdown) {
|
|
38
|
-
copyBtn.addEventListener('click', async () => {
|
|
39
|
-
try {
|
|
40
|
-
await navigator.clipboard.writeText(markdown.textContent || '');
|
|
41
|
-
copyBtn.textContent = 'Copied!';
|
|
42
|
-
copyBtn.classList.add('copied');
|
|
43
|
-
setTimeout(() => {
|
|
44
|
-
copyBtn.textContent = 'Copy as Markdown';
|
|
45
|
-
copyBtn.classList.remove('copied');
|
|
46
|
-
}, 2000);
|
|
47
|
-
} catch {
|
|
48
|
-
copyBtn.textContent = 'Copy failed';
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
document.querySelectorAll('.context-tab').forEach(tab => {
|
|
54
|
-
tab.addEventListener('click', () => {
|
|
55
|
-
const id = tab.getAttribute('data-tab');
|
|
56
|
-
document.querySelectorAll('.context-tab').forEach(t => t.classList.remove('active'));
|
|
57
|
-
document.querySelectorAll('.context-panel').forEach(p => p.classList.remove('active'));
|
|
58
|
-
tab.classList.add('active');
|
|
59
|
-
const panel = document.querySelector('[data-panel="' + id + '"]');
|
|
60
|
-
if (panel) panel.classList.add('active');
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
document.addEventListener('DOMContentLoaded', initErrorPage);
|
|
65
|
-
`;
|
|
33
|
+
export declare const ERROR_PAGE_SCRIPT: string;
|
|
66
34
|
export declare interface ParsedFrame {
|
|
67
35
|
file: string
|
|
68
36
|
line: number
|
package/dist/error-page.d.ts
CHANGED
|
@@ -30,123 +30,115 @@ export declare function renderError(error: Error, status?: number): Promise<stri
|
|
|
30
30
|
* Create an error response
|
|
31
31
|
*/
|
|
32
32
|
export declare function errorResponse(error: Error, status?: number, config?: ErrorPageConfig): Promise<Response>;
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* HTTP error definitions. Each entry includes a doc link, likely causes,
|
|
34
35
|
// and a concrete suggestion so the dev-mode error page reads like a hint
|
|
35
36
|
// instead of just "something went wrong".
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
504: {
|
|
142
|
-
status: 504;
|
|
143
|
-
title: 'Gateway Timeout';
|
|
144
|
-
message: 'The upstream server did not respond in time.';
|
|
145
|
-
docLink: `${DOCS_BASE}/504`;
|
|
146
|
-
commonCauses: readonly ['An upstream HTTP call exceeded its deadline', 'A long-running database query timed out'];
|
|
147
|
-
suggestion: 'Move the work to a queued job or raise the upstream timeout if the latency is expected.'
|
|
148
|
-
}
|
|
149
|
-
};
|
|
37
|
+
* @defaultValue
|
|
38
|
+
* ```ts
|
|
39
|
+
* {
|
|
40
|
+
* 400: {
|
|
41
|
+
* status: 400,
|
|
42
|
+
* title: 'Bad Request',
|
|
43
|
+
* message: 'The request was malformed or invalid.',
|
|
44
|
+
* commonCauses: [ 'JSON body is missing or has a syntax error', 'A required field is absent from the payload', 'Content-Type header does not match the body format', ],
|
|
45
|
+
* suggestion: 'Inspect the request body and Content-Type — most 400s come from malformed JSON or a missing required field.'
|
|
46
|
+
* },
|
|
47
|
+
* 401: {
|
|
48
|
+
* status: 401,
|
|
49
|
+
* title: 'Unauthorized',
|
|
50
|
+
* message: 'Authentication is required to access this resource.',
|
|
51
|
+
* commonCauses: [ 'No Authorization header was sent', 'The bearer token expired', 'The session cookie was cleared', ],
|
|
52
|
+
* suggestion: 'Confirm a valid `Authorization: Bearer <token>` header is sent and the token has not expired.'
|
|
53
|
+
* },
|
|
54
|
+
* 403: {
|
|
55
|
+
* status: 403,
|
|
56
|
+
* title: 'Forbidden',
|
|
57
|
+
* message: 'You do not have permission to access this resource.',
|
|
58
|
+
* commonCauses: [ 'The authenticated user lacks the required ability or role', 'A Gate or policy denied access (see app/Gates.ts)', 'The token was issued without the needed ability', ],
|
|
59
|
+
* suggestion: 'Check Gates / policies and the abilities encoded in the access token.'
|
|
60
|
+
* },
|
|
61
|
+
* 404: {
|
|
62
|
+
* status: 404,
|
|
63
|
+
* title: 'Not Found',
|
|
64
|
+
* message: 'The requested resource could not be found.',
|
|
65
|
+
* commonCauses: [ 'The route is not registered in app/Routes.ts', 'A typo in the URL path', 'A model lookup returned no row (ModelNotFoundError)', ],
|
|
66
|
+
* suggestion: 'Run `buddy route:list` to see registered routes, or verify the model exists with the given id.'
|
|
67
|
+
* },
|
|
68
|
+
* 405: {
|
|
69
|
+
* status: 405,
|
|
70
|
+
* title: 'Method Not Allowed',
|
|
71
|
+
* message: 'The request method is not supported for this resource.',
|
|
72
|
+
* commonCauses: [ 'The route is registered for a different HTTP method', 'A form posted GET when the route expects POST', ],
|
|
73
|
+
* suggestion: 'Confirm the HTTP method in `app/Routes.ts` matches what the client sent.'
|
|
74
|
+
* },
|
|
75
|
+
* 408: {
|
|
76
|
+
* status: 408,
|
|
77
|
+
* title: 'Request Timeout',
|
|
78
|
+
* message: 'The request took too long to complete.',
|
|
79
|
+
* commonCauses: [ 'A long-running query or external API call exceeded the timeout', 'The client uploaded a slow body that stalled', ],
|
|
80
|
+
* suggestion: 'Move slow work into a queued job, or raise the route timeout if the work is genuinely long.'
|
|
81
|
+
* },
|
|
82
|
+
* 409: {
|
|
83
|
+
* status: 409,
|
|
84
|
+
* title: 'Conflict',
|
|
85
|
+
* message: 'The request conflicts with the current state of the resource.',
|
|
86
|
+
* commonCauses: [ 'A unique-constraint violation (duplicate email, slug, etc.)', 'Optimistic locking detected a stale write', ],
|
|
87
|
+
* suggestion: 'Re-fetch the resource and retry, or surface the conflict to the user.'
|
|
88
|
+
* },
|
|
89
|
+
* 410: {
|
|
90
|
+
* status: 410,
|
|
91
|
+
* title: 'Gone',
|
|
92
|
+
* message: 'The requested resource is no longer available.',
|
|
93
|
+
* commonCauses: ['The resource was permanently deleted', 'A signed URL expired'],
|
|
94
|
+
* suggestion: 'Issue a fresh signed URL or fall back to the canonical resource.'
|
|
95
|
+
* },
|
|
96
|
+
* 422: {
|
|
97
|
+
* status: 422,
|
|
98
|
+
* title: 'Unprocessable Entity',
|
|
99
|
+
* message: 'The request was well-formed but could not be processed.',
|
|
100
|
+
* commonCauses: [ 'Validation rules from the action / model rejected the payload', 'A field value is outside the allowed range or shape', ],
|
|
101
|
+
* suggestion: 'Inspect `errors` in the response body — each key maps to a failing field.'
|
|
102
|
+
* },
|
|
103
|
+
* 429: {
|
|
104
|
+
* status: 429,
|
|
105
|
+
* title: 'Too Many Requests',
|
|
106
|
+
* message: 'You have exceeded the rate limit.',
|
|
107
|
+
* commonCauses: ['Rate-limit middleware tripped on this IP / token', 'A retry loop is hammering the endpoint'],
|
|
108
|
+
* suggestion: 'Honor the `Retry-After` response header and back off before retrying.'
|
|
109
|
+
* },
|
|
110
|
+
* 500: {
|
|
111
|
+
* status: 500,
|
|
112
|
+
* title: 'Internal Server Error',
|
|
113
|
+
* message: 'An unexpected error occurred on the server.',
|
|
114
|
+
* commonCauses: [ 'An unhandled exception in an action or middleware', 'A failing database connection or migration', 'A misconfigured environment variable', ],
|
|
115
|
+
* suggestion: 'Check server logs for the original stack trace — the error page above shows the throw site in dev.'
|
|
116
|
+
* },
|
|
117
|
+
* 502: {
|
|
118
|
+
* status: 502,
|
|
119
|
+
* title: 'Bad Gateway',
|
|
120
|
+
* message: 'The server received an invalid response from an upstream server.',
|
|
121
|
+
* commonCauses: ['An upstream HTTP API returned a malformed response', 'A reverse proxy could not reach the origin'],
|
|
122
|
+
* suggestion: 'Verify the upstream service is healthy and returning the expected content type.'
|
|
123
|
+
* },
|
|
124
|
+
* 503: {
|
|
125
|
+
* status: 503,
|
|
126
|
+
* title: 'Service Unavailable',
|
|
127
|
+
* message: 'The service is temporarily unavailable.',
|
|
128
|
+
* commonCauses: ['Maintenance mode is enabled', 'A health check is failing', 'A dependency (db, redis, queue) is down'],
|
|
129
|
+
* suggestion: 'Run `buddy doctor` and check dependent services.'
|
|
130
|
+
* },
|
|
131
|
+
* 504: {
|
|
132
|
+
* status: 504,
|
|
133
|
+
* title: 'Gateway Timeout',
|
|
134
|
+
* message: 'The upstream server did not respond in time.',
|
|
135
|
+
* commonCauses: ['An upstream HTTP call exceeded its deadline', 'A long-running database query timed out'],
|
|
136
|
+
* suggestion: 'Move the work to a queued job or raise the upstream timeout if the latency is expected.'
|
|
137
|
+
* }
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare const HTTP_ERRORS: Record<HttpStatusCode, HttpError>;
|
|
150
142
|
/**
|
|
151
143
|
* Error Page Rendering - Ignition-style error pages
|
|
152
144
|
*
|
package/dist/handler.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { LogErrorOptions } from '@stacksjs/logging';
|
|
|
3
3
|
// Function to update the default log path when config is available
|
|
4
4
|
export declare function setLogPath(path: string): void;
|
|
5
5
|
export declare function writeToLogFile(message: string, options?: WriteOptions): Promise<void>;
|
|
6
|
-
export declare function handleError(err: string | Error | object | unknown, options?:
|
|
6
|
+
export declare function handleError(err: string | Error | object | unknown, options?: unknown): Error;
|
|
7
7
|
/**
|
|
8
8
|
* Context information attached to errors for better debugging.
|
|
9
9
|
*/
|
package/dist/handler.js
CHANGED
|
@@ -84,14 +84,14 @@ export async function writeToLogFile(message, options) {
|
|
|
84
84
|
await fs.promises.appendFile(logFile, formattedMessage);
|
|
85
85
|
}
|
|
86
86
|
export function handleError(err, options) {
|
|
87
|
-
let errorMessage, contextData;
|
|
88
|
-
if (options && typeof options === "object" &&
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
let errorMessage, contextData, errorOptions;
|
|
88
|
+
if (options && typeof options === "object" && (("shouldExit" in options) || ("silent" in options)))
|
|
89
|
+
errorOptions = options;
|
|
90
|
+
else if (options !== void 0)
|
|
91
|
+
contextData = options && typeof options === "object" ? options : { error: options };
|
|
92
92
|
const errMsg = err instanceof Error ? err.message : typeof err === "string" ? err : JSON.stringify(err);
|
|
93
|
-
if (
|
|
94
|
-
errorMessage = `${errMsg}: ${
|
|
93
|
+
if (errorOptions?.message)
|
|
94
|
+
errorMessage = `${errMsg}: ${errorOptions.message}`;
|
|
95
95
|
else
|
|
96
96
|
errorMessage = errMsg;
|
|
97
97
|
let logMessage = `ERROR: ${stripAnsi(errorMessage)}`;
|
|
@@ -104,5 +104,5 @@ Context: ${JSON.stringify(contextData, null, 2)}`;
|
|
|
104
104
|
const error = Error(errorMessage);
|
|
105
105
|
if (err instanceof Error)
|
|
106
106
|
Object.assign(error, err);
|
|
107
|
-
return ErrorHandler.handle(error,
|
|
107
|
+
return ErrorHandler.handle(error, errorOptions);
|
|
108
108
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/error-handling",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.70.
|
|
4
|
+
"version": "0.70.75",
|
|
5
5
|
"description": "Type safe error handling.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"ts-syntax-highlighter": "^0.2.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@stacksjs/cli": "0.70.
|
|
61
|
-
"@stacksjs/config": "0.70.
|
|
62
|
-
"better-dx": "^0.2.
|
|
63
|
-
"@stacksjs/path": "0.70.
|
|
64
|
-
"@stacksjs/types": "0.70.
|
|
65
|
-
"@stacksjs/validation": "0.70.
|
|
60
|
+
"@stacksjs/cli": "0.70.75",
|
|
61
|
+
"@stacksjs/config": "0.70.75",
|
|
62
|
+
"better-dx": "^0.2.16",
|
|
63
|
+
"@stacksjs/path": "0.70.75",
|
|
64
|
+
"@stacksjs/types": "0.70.75",
|
|
65
|
+
"@stacksjs/validation": "0.70.75"
|
|
66
66
|
},
|
|
67
67
|
"sideEffects": false
|
|
68
68
|
}
|