From 8538b632463edd4c81b6fe23d3c8fbbc490705a2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 26 Jul 2025 23:12:56 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Create=20themed=20error=20pages?= =?UTF-8?q?=20matching=20agent=20UI=20design?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ New Features: - Complete redesign of 404, 500, 403, and 400 error pages - Agent-themed UI with header, navigation, and widget components - Component-based architecture using agent-base.css styling - Responsive design with proper error handling 🔧 Technical Improvements: - Custom error handlers for production (DEBUG=False) - Proper Django error view integration - Authentication-aware error pages (403 shows login options) - Interactive elements (refresh, go back, contact support) đŸŽ¯ UI/UX Enhancements: - Consistent branding with agent ecosystem - Quick links to popular agents on 404 page - System status indicators on 500 page - Troubleshooting steps on 400 page - Professional error messaging Error pages now feel integrated with the platform instead of generic Django errors. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- core/error_views.py | 38 +++++ netcop_hub/urls.py | 6 + templates/400.html | 334 +++++++++++++++++++++++++++++++++++++ templates/403.html | 212 ++++++++++++++++++++++++ templates/404.html | 259 ++++++++++++++++++++++------- templates/500.html | 393 +++++++++++++++++++++++++++++++++----------- 6 files changed, 1085 insertions(+), 157 deletions(-) create mode 100644 core/error_views.py create mode 100644 templates/400.html create mode 100644 templates/403.html diff --git a/core/error_views.py b/core/error_views.py new file mode 100644 index 0000000..ce0604b --- /dev/null +++ b/core/error_views.py @@ -0,0 +1,38 @@ +from django.shortcuts import render +from django.http import HttpResponseNotFound, HttpResponseServerError, HttpResponseForbidden, HttpResponseBadRequest + + +def custom_404_view(request, exception): + """Custom 404 error page with agent theme""" + return HttpResponseNotFound( + render(request, '404.html', { + 'timestamp': '1.0' # Cache busting for CSS + }).content + ) + + +def custom_500_view(request): + """Custom 500 error page with agent theme""" + return HttpResponseServerError( + render(request, '500.html', { + 'timestamp': '1.0' # Cache busting for CSS + }).content + ) + + +def custom_403_view(request, exception): + """Custom 403 error page with agent theme""" + return HttpResponseForbidden( + render(request, '403.html', { + 'timestamp': '1.0' # Cache busting for CSS + }).content + ) + + +def custom_400_view(request, exception): + """Custom 400 error page with agent theme""" + return HttpResponseBadRequest( + render(request, '400.html', { + 'timestamp': '1.0' # Cache busting for CSS + }).content + ) \ No newline at end of file diff --git a/netcop_hub/urls.py b/netcop_hub/urls.py index 22b04ac..e789af5 100644 --- a/netcop_hub/urls.py +++ b/netcop_hub/urls.py @@ -47,3 +47,9 @@ if settings.DEBUG: ] + urlpatterns except ImportError: pass + +# Custom error handlers (work in production when DEBUG=False) +handler404 = 'core.error_views.custom_404_view' +handler500 = 'core.error_views.custom_500_view' +handler403 = 'core.error_views.custom_403_view' +handler400 = 'core.error_views.custom_400_view' diff --git a/templates/400.html b/templates/400.html new file mode 100644 index 0000000..79a58f8 --- /dev/null +++ b/templates/400.html @@ -0,0 +1,334 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %}Bad Request - Quantum Tasks AI{% endblock %} + +{% block extra_css %} + +{% endblock %} + +{% block content %} + +{% include "components/agent_header.html" with agent_title="Bad Request" agent_subtitle="Invalid request format detected" %} + + +{% include "components/quick_agents_panel.html" %} + + +
+
+ +
+
+

+ âš ī¸ + 400 - Bad Request +

+

Request format is invalid or malformed

+
+ +
+
+
+
📝
+

+ Your request couldn't be processed because it contains invalid data or is malformed. + Please check your input and try again. +

+
+ +
+

Common Issues:

+
+
+ 📄 + Check file format and size limits +
+
+ đŸ’Ŧ + Ensure all required fields are filled +
+
+ 🔗 + Verify URL parameters are correct +
+
+ 🔒 + Check if you're properly authenticated +
+
+
+ +
+
+ + + 🏠 + Go Home + +
+ +
+

Try using our AI agents with proper input:

+ +
+
+
+
+
+ + +
+
+

+ đŸ› ī¸ + Troubleshooting +

+
+
+
+
+
+ 1 + Refresh the page +
+
+ 2 + Check your input data +
+
+ 3 + Clear browser cache +
+
+ 4 + Try a different browser +
+
+ +
+ + + 📧 Contact Support + +
+
+
+
+
+
+ + +{% endblock %} \ No newline at end of file diff --git a/templates/403.html b/templates/403.html new file mode 100644 index 0000000..8c509c1 --- /dev/null +++ b/templates/403.html @@ -0,0 +1,212 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %}Access Denied - Quantum Tasks AI{% endblock %} + +{% block extra_css %} + +{% endblock %} + +{% block content %} + +{% include "components/agent_header.html" with agent_title="Access Denied" agent_subtitle="You don't have permission to access this resource" %} + + +{% include "components/quick_agents_panel.html" %} + + +
+
+ +
+
+

+ đŸ›Ąī¸ + 403 - Access Denied +

+

Permission required to access this resource

+
+ +
+
+
+
🔒
+

+ You don't have the necessary permissions to access this resource. + Please log in with the appropriate account or contact support for assistance. +

+
+ +
+
+ {% if not user.is_authenticated %} + + 🔑 + Login + + + 📝 + Register + + {% else %} + + 🏠 + Go Home + + + 🤖 + Browse AI Agents + + {% endif %} +
+ + {% if user.is_authenticated %} + + {% endif %} +
+
+
+
+ + +
+
+

+ 🆘 + Need Access? +

+
+
+
+

If you need access to this resource:

+ +
+
+
+
+
+ + +{% endblock %} \ No newline at end of file diff --git a/templates/404.html b/templates/404.html index 2c5e417..db886fb 100644 --- a/templates/404.html +++ b/templates/404.html @@ -4,90 +4,231 @@ {% block title %}Page Not Found - Quantum Tasks AI{% endblock %} {% block extra_css %} + +{% endblock %} + +{% block content %} + +{% include "components/agent_header.html" with agent_title="Page Not Found" agent_subtitle="The page you're looking for doesn't exist" %} + + +{% include "components/quick_agents_panel.html" %} + + +
+
+ +
+
+

+ 🔍 + 404 - Page Not Found +

+

Let's get you back on track

+
+ +
+
+
+
đŸ•ĩī¸â€â™‚ī¸
+

+ The page you're looking for doesn't exist or has been moved. + Our AI agents are ready to help you find what you need! +

+
+ + +
+
+
+ + +
+
+

+ 💡 + Need Help? +

+
+ +
+
+
+ -{% endblock %} - -{% block content %} -
-
🔍
-

Page Not Found

-

- The page you're looking for doesn't exist or has been moved. - Don't worry, let's get you back on track to explore our AI assistants. -

- -
{% endblock %} \ No newline at end of file diff --git a/templates/500.html b/templates/500.html index ad906ab..44af1b3 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,108 +1,305 @@ +{% extends 'base.html' %} {% load static %} - - - - - - Server Error - Quantum Tasks AI - - - - -
-
âš ī¸
-

Server Error

-

- We're experiencing technical difficulties. Our team has been notified - and is working to resolve the issue. Please try again in a few minutes. -

-
- - 🏠 Go Home - - - 🤖 Browse AI Assistants - + +
+
+ +
+
+

+ âš ī¸ + 500 - Server Error +

+

Technical difficulties detected

+
+ +
+
+
+
🔧
+

+ We're experiencing technical difficulties. Our AI systems are temporarily unavailable, + but our team has been notified and is working to resolve the issue. +

+
+ +
+
+
+ System monitoring active +
+
+ +
+ + +
+

You can try refreshing the page in a few minutes

+ +
+
+
+
-
-

Error ID: {{ request.META.HTTP_X_REQUEST_ID|default:"N/A" }}

-

Time:

+ + +
+
+

+ 📊 + System Status +

+
+
+
+
+ 🟡 +
+ AI Services + Investigating +
+
+
+ đŸŸĸ +
+ Website + Operational +
+
+
+ đŸŸĸ +
+ Database + Operational +
+
+ +
+

+ Error ID: + {{ request.META.HTTP_X_REQUEST_ID|default:"N/A" }} +

+

+ Time: + +

+

+ Support: + + support@quantumtaskai.com + +

+
+
+
+
- - - \ No newline at end of file + + + +{% endblock %} \ No newline at end of file