feat: improve default error visualization (#1780)
Adds code frame to errors if possible: <img width="1095" alt="Screenshot 2023-09-15 at 11 33 46" src="https://github.com/denoland/fresh/assets/1062408/7f4a5378-d00f-4550-b995-37a77f96ce0c"> Default error page in dev mode: <img width="937" alt="Screenshot 2023-09-15 at 11 30 59" src="https://github.com/denoland/fresh/assets/1062408/130172f4-beed-4d8c-b2b5-0e23be0b8f84"> Default error page in prod mode: <img width="939" alt="Screenshot 2023-09-15 at 11 31 23" src="https://github.com/denoland/fresh/assets/1062408/4ef58b83-b5f4-45cb-bc3f-1c8c4e5b6357">
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
export const snapshot = {};
|
||||
|
||||
snapshot[`createCodeFrame markers 1`] = `
|
||||
"
|
||||
1 | foo
|
||||
> 2 | bar
|
||||
| ^
|
||||
3 | baz
|
||||
"
|
||||
`;
|
||||
|
||||
snapshot[`createCodeFrame markers 2`] = `
|
||||
"
|
||||
> 1 | foo
|
||||
| ^
|
||||
2 | bar
|
||||
3 | baz
|
||||
"
|
||||
`;
|
||||
|
||||
snapshot[`createCodeFrame markers 3`] = `
|
||||
"
|
||||
1 | foo
|
||||
2 | bar
|
||||
> 3 | baz
|
||||
| ^
|
||||
"
|
||||
`;
|
||||
|
||||
snapshot[`createCodeFrame markers 4`] = `
|
||||
"
|
||||
7 |
|
||||
8 |
|
||||
> 9 | bar
|
||||
| ^
|
||||
10 |
|
||||
11 |
|
||||
12 | bar
|
||||
"
|
||||
`;
|
||||
|
||||
snapshot[`createCodeFrame with indentation 1`] = `
|
||||
"
|
||||
1 | foo
|
||||
> 2 | bar
|
||||
| ^
|
||||
3 | baz
|
||||
"
|
||||
`;
|
||||
|
||||
snapshot[`createCodeFrame with indentation 2`] = `
|
||||
"
|
||||
1 | foo
|
||||
> 2 | bar
|
||||
| ^
|
||||
3 | baz
|
||||
"
|
||||
`;
|
||||
Reference in New Issue
Block a user