File size: 8,904 Bytes
82c705b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Error - AI Sentiment Analyzer</title>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .error-container {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            padding: 3rem 2rem;
            border-radius: 20px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            max-width: 600px;
            width: 100%;
            text-align: center;
            animation: fadeInUp 0.5s ease-out;
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .error-icon {
            font-size: 4rem;
            color: #ef4444;
            margin-bottom: 1.5rem;
            animation: bounce 2s infinite;
        }

        @keyframes bounce {
            0%, 20%, 50%, 80%, 100% {
                transform: translateY(0);
            }
            40% {
                transform: translateY(-10px);
            }
            60% {
                transform: translateY(-5px);
            }
        }

        .error-code {
            font-size: 6rem;
            font-weight: 700;
            background: linear-gradient(135deg, #ef4444, #dc2626);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 1rem;
            line-height: 1;
        }

        .error-title {
            font-size: 2rem;
            font-weight: 600;
            color: #374151;
            margin-bottom: 1rem;
        }

        .error-message {
            font-size: 1.1rem;
            color: #6b7280;
            margin-bottom: 2rem;
            line-height: 1.6;
        }

        .error-details {
            background: #f8fafc;
            border-left: 4px solid #ef4444;
            padding: 1rem 1.5rem;
            border-radius: 0 10px 10px 0;
            margin-bottom: 2rem;
            text-align: left;
        }

        .error-details h4 {
            color: #374151;
            font-weight: 600;
            margin-bottom: 0.5rem;
        }

        .error-details p {
            color: #6b7280;
            font-size: 0.9rem;
        }

        .actions {
            display: flex;
            gap: 1rem;
            justify-content: center;
            flex-wrap: wrap;
        }

        .btn {
            padding: 1rem 2rem;
            border: none;
            border-radius: 15px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
        }

        .btn-secondary {
            background: white;
            color: #667eea;
            border: 2px solid #667eea;
        }

        .btn-secondary:hover {
            background: #667eea;
            color: white;
            transform: translateY(-2px);
        }

        .suggestions {
            background: #f0f9ff;
            border: 1px solid #bae6fd;
            padding: 1.5rem;
            border-radius: 15px;
            margin-top: 2rem;
            text-align: left;
        }

        .suggestions h4 {
            color: #0369a1;
            font-weight: 600;
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .suggestions ul {
            color: #0369a1;
            padding-left: 1.5rem;
        }

        .suggestions li {
            margin-bottom: 0.5rem;
        }

        @media (max-width: 768px) {
            .error-container {
                padding: 2rem 1.5rem;
                margin: 10px;
            }

            .error-code {
                font-size: 4rem;
            }

            .error-title {
                font-size: 1.5rem;
            }

            .actions {
                flex-direction: column;
            }

            .btn {
                width: 100%;
                justify-content: center;
            }
        }
    </style>
</head>
<body>
    <div class="error-container">
        <div class="error-icon">
            <i class="fas fa-exclamation-triangle"></i>
        </div>
        
        <div class="error-code">{{ error_code or 'Error' }}</div>
        
        <h1 class="error-title">
            {% if error_code == 400 %}
                Bad Request
            {% elif error_code == 404 %}
                Page Not Found
            {% elif error_code == 413 %}
                Request Too Large
            {% elif error_code == 500 %}
                Server Error
            {% elif error_code == 503 %}
                Service Unavailable
            {% else %}
                Something Went Wrong
            {% endif %}
        </h1>
        
        <p class="error-message">
            {{ error_message or 'An unexpected error occurred. Please try again later.' }}
        </p>

        {% if error_code == 400 %}
        <div class="suggestions">
            <h4><i class="fas fa-lightbulb"></i> Suggestions:</h4>
            <ul>
                <li>Make sure your text is between 3-1000 characters</li>
                <li>Check that you've entered some text to analyze</li>
                <li>Try using plain text without special formatting</li>
            </ul>
        </div>
        {% elif error_code == 413 %}
        <div class="suggestions">
            <h4><i class="fas fa-lightbulb"></i> Suggestions:</h4>
            <ul>
                <li>Shorten your text to under 1000 characters</li>
                <li>Try analyzing smaller chunks of text</li>
                <li>Break long documents into smaller pieces</li>
            </ul>
        </div>
        {% elif error_code == 500 or error_code == 503 %}
        <div class="suggestions">
            <h4><i class="fas fa-lightbulb"></i> What you can do:</h4>
            <ul>
                <li>Wait a moment and try again</li>
                <li>Check your internet connection</li>
                <li>Try with a shorter text sample</li>
                <li>Contact support if the problem persists</li>
            </ul>
        </div>
        {% endif %}

        <div class="actions">
            <a href="/" class="btn btn-primary">
                <i class="fas fa-home"></i>
                Go Home
            </a>
            <button class="btn btn-secondary" onclick="history.back()">
                <i class="fas fa-arrow-left"></i>
                Go Back
            </button>
        </div>
    </div>

    <script>
        // Auto-refresh for server errors after 10 seconds
        {% if error_code == 500 or error_code == 503 %}
        let countdown = 10;
        const refreshBtn = document.createElement('div');
        refreshBtn.style.cssText = `
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: rgba(102, 126, 234, 0.9);
            color: white;
            padding: 10px 20px;
            border-radius: 10px;
            font-size: 0.9rem;
            backdrop-filter: blur(10px);
        `;
        refreshBtn.innerHTML = `Auto-refresh in ${countdown}s`;
        document.body.appendChild(refreshBtn);

        const timer = setInterval(() => {
            countdown--;
            refreshBtn.innerHTML = `Auto-refresh in ${countdown}s`;
            if (countdown <= 0) {
                clearInterval(timer);
                window.location.reload();
            }
        }, 1000);

        // Click to cancel auto-refresh
        refreshBtn.addEventListener('click', () => {
            clearInterval(timer);
            refreshBtn.remove();
        });
        {% endif %}
    </script>
</body>
</html>