Skip to content

Commit

Permalink
fix: report errors with prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-nick committed May 8, 2024
1 parent 772c3b1 commit e2dde89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions frontend/src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { logError } from "../error";
import "./App.css";
import Inspect from "./Inspect";
import Loader from "./Loader";
Expand Down Expand Up @@ -55,9 +56,9 @@ export default function App() {
setProcessedSource(null);
setManifestStore(null);

getCurrent().setSize(new LogicalSize(304, 242)).catch(reportError);
getCurrent().setSize(new LogicalSize(304, 242)).catch(logError);

reportError(err);
logError(err);
}, []);

const handleInspect = useCallback((source: InspectSourceType) => {
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { logError } from "../error";
import "./Editor.css";
import Loader from "./Loader";
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
Expand Down Expand Up @@ -27,9 +28,9 @@ export default function Editor() {
// TODO: implement manifest editing
}
})
.catch(reportError);
.catch(logError);

webview.emit("request-edit-info").catch(reportError);
webview.emit("request-edit-info").catch(logError);
}
}, []);

Expand Down
6 changes: 4 additions & 2 deletions frontend/src/error.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { message } from "@tauri-apps/plugin-dialog";

export function reportError(err: string) {
export function logError(err: string) {
console.error(err);
// If this fails, whataya gonna do
void message(err, {
message(err, {
kind: "error",
}).catch((err) => {
console.error(err);
});
}

0 comments on commit e2dde89

Please sign in to comment.