Skip to content

Commit 09c3c8a

Browse files
Merge pull request #20 from Chidwan3578/main
docs: add common HTTP error codes table to documentation page (issue)#15
2 parents 0f56c5a + 15416e6 commit 09c3c8a

1 file changed

Lines changed: 46 additions & 2 deletions

File tree

frontend/src/pages/Docs.jsx

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from 'react';
2-
import { Copy, Terminal, Database, Shield, HardDrive, Check, Server, Menu, X, ChevronDown, AlertCircle, Zap } from 'lucide-react';
2+
import { Copy, Terminal, Database, Shield, HardDrive, Check, Server, Menu, X, ChevronDown, AlertCircle, Zap, AlertTriangle } from 'lucide-react';
33
import { API_URL } from '../config';
44

55
import Footer from '../components/Layout/Footer';
@@ -88,6 +88,28 @@ console.log(data);
8888
</div>
8989
);
9090

91+
// Helper for Error Status Codes Table
92+
const ErrorTable = ({ errors }) => (
93+
<div style={{ margin: '1rem 0', overflowX: 'auto' }}>
94+
<table style={{ width: '100%', fontSize: '0.9rem', borderCollapse: 'collapse' }}>
95+
<thead>
96+
<tr style={{ borderBottom: '1px solid #333', textAlign: 'left' }}>
97+
<th style={{ padding: '8px', color: '#888' }}>Status Code</th>
98+
<th style={{ padding: '8px', color: '#888' }}>Description</th>
99+
</tr>
100+
</thead>
101+
<tbody>
102+
{errors.map((e, i) => (
103+
<tr key={i} style={{ borderBottom: '1px solid #222' }}>
104+
<td style={{ padding: '8px', fontFamily: 'monospace', color: 'var(--color-primary)' }}>{e.code}</td>
105+
<td style={{ padding: '8px', color: '#ddd' }}>{e.desc}</td>
106+
</tr>
107+
))}
108+
</tbody>
109+
</table>
110+
</div>
111+
);
112+
91113
const renderContent = () => {
92114
switch (activeTab) {
93115
case 'intro':
@@ -131,6 +153,27 @@ console.log(data);
131153
</div>
132154
);
133155

156+
case 'errors':
157+
return (
158+
<div className="fade-in">
159+
<h2 className="page-title" style={{ marginBottom: '1rem' }}>Error Reference</h2>
160+
<p style={{ color: 'var(--color-text-muted)', marginBottom: '2rem' }}>
161+
Common HTTP status codes and their meanings when making API requests.
162+
</p>
163+
164+
<h3 style={{ fontSize: '1.2rem', marginBottom: '1rem', display: 'flex', alignItems: 'center', gap: '10px' }}>
165+
<AlertTriangle size={18} /> Status Codes
166+
</h3>
167+
<ErrorTable errors={[
168+
{ code: '400 Bad Request', desc: 'Invalid JSON or missing required schema fields.' },
169+
{ code: '401 Unauthorized', desc: 'Invalid or missing API Key/JWT Token.' },
170+
{ code: '403 Forbidden', desc: 'Resource limits exceeded (e.g., database or storage quota).' },
171+
{ code: '404 Not Found', desc: 'Collection or document does not exist.' },
172+
{ code: '500 Internal Server Error', desc: 'Unexpected server-side issues.' },
173+
]} />
174+
</div>
175+
);
176+
134177
case 'limits':
135178
return (
136179
<div className="fade-in">
@@ -359,7 +402,8 @@ console.log("File URL:", result.url);
359402
<ul style={{ listStyle: 'none', padding: 0 }}>
360403
{[
361404
{ id: 'intro', label: 'Introduction', icon: Terminal },
362-
{ id: 'limits', label: 'Limits & Quotas', icon: AlertCircle }, // New Tab
405+
{ id: 'errors', label: 'Error Reference', icon: AlertTriangle },
406+
{ id: 'limits', label: 'Limits & Quotas', icon: AlertCircle },
363407
{ id: 'auth', label: 'Authentication', icon: Shield },
364408
{ id: 'data', label: 'Database & API', icon: Database },
365409
{ id: 'storage', label: 'Storage', icon: HardDrive },

0 commit comments

Comments
 (0)