Skip to content

Commit b5e6a34

Browse files
committed
Fix error handling
1 parent 8166903 commit b5e6a34

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/components/DocumentList.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Transition, TransitionChild, DialogPanel, DialogTitle } from '@headless
55
import { Fragment, useState } from 'react';
66

77
export function DocumentList() {
8-
const { documents, removeDocument, isLoading, error } = usePDF();
8+
const { documents, removeDocument, isLoading } = usePDF();
99
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
1010
const [documentToDelete, setDocumentToDelete] = useState<{ id: string; name: string } | null>(null);
1111

@@ -29,14 +29,6 @@ export function DocumentList() {
2929
);
3030
}
3131

32-
if (error) {
33-
return (
34-
<div className="w-full text-center text-red-500">
35-
{error}
36-
</div>
37-
);
38-
}
39-
4032
if (documents.length === 0) {
4133
return (
4234
<div className="w-full text-center text-muted">

src/components/PDFUploader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface PDFUploaderProps {
99
}
1010

1111
export function PDFUploader({ className = '' }: PDFUploaderProps) {
12-
const { addDocument, error: contextError } = usePDF();
12+
const { addDocument } = usePDF();
1313
const [isUploading, setIsUploading] = useState(false);
1414
const [error, setError] = useState<string | null>(null);
1515

@@ -21,13 +21,13 @@ export function PDFUploader({ className = '' }: PDFUploaderProps) {
2121
try {
2222
await addDocument(file);
2323
} catch (err) {
24-
setError(contextError || 'Failed to upload PDF. Please try again.');
24+
setError('Failed to upload PDF. Please try again.');
2525
console.error('Upload error:', err);
2626
} finally {
2727
setIsUploading(false);
2828
}
2929
}
30-
}, [addDocument, contextError]);
30+
}, [addDocument]);
3131

3232
const { getRootProps, getInputProps, isDragActive } = useDropzone({
3333
onDrop,

0 commit comments

Comments
 (0)