Skip to content

Commit

Permalink
add custom error views
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadezhda Mishchenko committed Nov 27, 2023
1 parent 2137a0d commit 0e6c560
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 6 deletions.
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

0 comments on commit 0e6c560

Please sign in to comment.