Skip to content

Commit

Permalink
Merge pull request #18 from ValtechMobility/dlcm/custom_error_views
Browse files Browse the repository at this point in the history
add custom error views fix
  • Loading branch information
mishchenk0 authored Nov 27, 2023
2 parents 2fc14b3 + d0e0025 commit 4d021aa
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 462 deletions.
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

0 comments on commit 4d021aa

Please sign in to comment.