Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom error views fix #18

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
225 changes: 119 additions & 106 deletions superset-frontend/src/assets/staticPages/404.html

Large diffs are not rendered by default.

122 changes: 0 additions & 122 deletions superset-frontend/src/assets/staticPages/404_custom.html

This file was deleted.

225 changes: 120 additions & 105 deletions superset-frontend/src/assets/staticPages/500.html

Large diffs are not rendered by default.

123 changes: 0 additions & 123 deletions superset-frontend/src/assets/staticPages/500_custom.html

This file was deleted.

8 changes: 4 additions & 4 deletions superset-frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ const plugins = [

// static pages
new HtmlWebpackPlugin({
template: './src/assets/staticPages/404_custom.html',
template: './src/assets/staticPages/404.html',
inject: true,
chunks: [],
filename: '404_custom.html',
filename: '404.html',
}),
new HtmlWebpackPlugin({
template: './src/assets/staticPages/500_custom.html',
template: './src/assets/staticPages/500.html',
inject: true,
chunks: [],
filename: '500_custom.html',
filename: '500.html',
}),
];

Expand Down
4 changes: 2 additions & 2 deletions superset/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def show_http_exception(ex: HTTPException) -> FlaskResponse:
def show_command_errors(ex: CommandException) -> FlaskResponse:
logger.warning("CommandException", exc_info=True)
if "text/html" in request.accept_mimetypes and not config["DEBUG"]:
path = resource_filename("superset", "static/assets/500_custom.html")
path = resource_filename("superset", "static/assets/500.html")
return send_file(path, cache_timeout=0), 500

extra = ex.normalized_messages() if isinstance(ex, CommandInvalidError) else {}
Expand All @@ -529,7 +529,7 @@ def show_command_errors(ex: CommandException) -> FlaskResponse:
def show_unexpected_exception(ex: Exception) -> FlaskResponse:
logger.exception(ex)
if "text/html" in request.accept_mimetypes and not config["DEBUG"]:
path = resource_filename("superset", "static/assets/500_custom.html")
path = resource_filename("superset", "static/assets/500.html")
return send_file(path, cache_timeout=0), 500

return json_errors_response(
Expand Down
Loading