-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render error page on theme asset upload error
- Loading branch information
1 parent
6edd52f
commit 7152c71
Showing
2 changed files
with
46 additions
and
20 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
packages/theme/src/cli/utilities/theme-environment/hot-reload/error-page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
interface Error { | ||
message: string | ||
code: string | ||
} | ||
|
||
export function getErrorPage(options: {title: string; header: string; errors: Error[]}) { | ||
const html = String.raw | ||
|
||
return html`<html> | ||
<head> | ||
<title>${options.title ?? 'Unknown error'}</title> | ||
</head> | ||
<body | ||
id="full-error-page" | ||
style="display: flex; flex-direction: column; align-items: center; padding-top: 20px; font-family: Arial" | ||
> | ||
<h1>${options.header}</h1> | ||
${options.errors | ||
.map( | ||
(error) => | ||
`<p>${error.message}</p> | ||
<pre>${error.code}</pre>`, | ||
) | ||
.join('')} | ||
</body> | ||
</html>` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters