-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from springload/feature/500
Custom 500 error handling with context for messages and email excepti…
- Loading branch information
Showing
5 changed files
with
143 additions
and
63 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,17 +1,58 @@ | ||
<!DOCTYPE html> | ||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | ||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | ||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | ||
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<title>Internal server error</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
</head> | ||
<body> | ||
<h1>Internal server error</h1> | ||
|
||
<h2>Sorry, there seems to be an error. Please try again soon.</h2> | ||
</body> | ||
</html> | ||
{% extends "base.html" %} | ||
|
||
{% block body_class %}template-500{% endblock %} | ||
|
||
{% block title %}- 500 - Internal server error{% endblock %} | ||
|
||
{% block main_content %} | ||
<main id="content"> | ||
<div class="bg-white border-bottom"> | ||
<div class="container pb-3"> | ||
|
||
<nav aria-label="breadcrumbs"> | ||
<ol class="breadcrumb bg-transparent pt-4 mb-0"> | ||
<li class="breadcrumb-item h5"> | ||
<a class="text-dark" href="/" aria-label="Home"> | ||
<span class="icon ion-android-home" aria-hidden="true"></span> | ||
</a> | ||
</li> | ||
</ol> | ||
</nav> | ||
|
||
|
||
<div class="u-max-text-width"> | ||
<h1>HTTP Status Code: 500 Internal Server Error</h1> | ||
|
||
<p>Ooops, something went wrong. We are looking into it, please try again soon.</p> | ||
|
||
{% if messages %} | ||
<ul class="messages"> | ||
{% for message in messages %} | ||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
</div> | ||
|
||
<div class="row mb-4 mt-4"> | ||
<div class="col-md-8 col-lg-6"> | ||
<form class="input-group" action="{% url 'search' %}" method="GET" name="search"> | ||
<input id="search-box2" class="form-control" type="text" placeholder="Search" aria-label="Search website" name="query" /> | ||
<button class="btn btn-primary" type="submit" aria-label="Submit website search">Go</button> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="container py-4 py-lg-5"> | ||
<div class="u-max-text-width"> | ||
<h2>Report problems</h2> | ||
<p>If the matter is urgent, please email <a href="mailto:support@ietf.org">support@ietf.org</a> .</p> | ||
</div> | ||
</div> | ||
|
||
</main> | ||
|
||
{% endblock %} |
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
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,7 @@ | ||
from django.http import HttpResponseServerError | ||
from django.template.loader import get_template | ||
|
||
|
||
def server_error(request, template_name="500.html"): | ||
t = get_template(template_name) | ||
return HttpResponseServerError(t.render(locals(), request)) |