Skip to content

Commit

Permalink
improve errors, fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vwh committed Aug 6, 2024
1 parent bd4e817 commit be106d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
20 changes: 16 additions & 4 deletions src/components/landing/dropzone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,27 @@ export default function UploadFile() {
setTables([]);
setSelectedTable("0");

if (acceptedFiles.length > 0) {
await loadDatabase(acceptedFiles[0]);
}

if (fileRejections.length > 0) {
const rejectionErrors = fileRejections.flatMap(
(rejection) => rejection.errors
);
setErrors(rejectionErrors);
return;
}

if (acceptedFiles.length > 0) {
try {
await loadDatabase(acceptedFiles[0]);
} catch (error) {
console.error("Failed to load database:", error);
if (error instanceof Error) {
return toast(error.message, { position: "bottom-right" });
} else {
return toast("Failed to load database", {
position: "bottom-right"
});
}
}
}
},
[loadDatabase, setTables, setSelectedTable]
Expand Down
3 changes: 1 addition & 2 deletions src/components/ui/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as React from "react";

import { cn } from "@/lib/utils";

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
type InputProps = React.InputHTMLAttributes<HTMLInputElement>;

const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
Expand Down
1 change: 1 addition & 0 deletions src/store/useSQLiteStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const initializeStore = create<SQLiteState>((set, get) => ({
} catch (error) {
console.error("Failed to load database:", error);
set({ isLoading: false, queryError: "Failed to load database" });
throw error;
}
},

Expand Down

0 comments on commit be106d6

Please sign in to comment.