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 #17

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
122 changes: 122 additions & 0 deletions superset-frontend/src/assets/staticPages/404_custom.html

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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.html',
template: './src/assets/staticPages/404_custom.html',
inject: true,
chunks: [],
filename: '404.html',
filename: '404_custom.html',
}),
new HtmlWebpackPlugin({
template: './src/assets/staticPages/500.html',
template: './src/assets/staticPages/500_custom.html',
inject: true,
chunks: [],
filename: '500.html',
filename: '500_custom.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.html")
path = resource_filename("superset", "static/assets/500_custom.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.html")
path = resource_filename("superset", "static/assets/500_custom.html")
return send_file(path, cache_timeout=0), 500

return json_errors_response(
Expand Down
Loading