Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/desktop/src/routes/app.new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { zodValidator } from "@tanstack/zod-adapter";
import { z } from "zod";

import { commands as dbCommands } from "@hypr/plugin-db";
import { logFrontendError } from "@/logging/frontend-logger";

const schema = z.object({
record: z.boolean().optional(),
Expand Down Expand Up @@ -86,7 +87,7 @@ export const Route = createFileRoute("/app/new")({
params: { id: sessionId },
});
} catch (error) {
console.error(error);
logFrontendError("route.new.create_session_failed", error, { calendarEventId, record });
return redirect({ to: "/app" });
}
},
Expand Down
7 changes: 4 additions & 3 deletions apps/desktop/src/routes/app.note.$id.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { createFileRoute, redirect, useNavigate } from "@tanstack/react-router";
import { useEffect } from "react";
import { logFrontendError } from "@/logging/frontend-logger";

import EditorArea from "@/components/editor-area";
import { useHypr } from "@/contexts";
Expand All @@ -27,7 +28,7 @@ export const Route = createFileRoute("/app/note/$id")({
]);
session = s;
} catch (e) {
console.error(e);
logFrontendError("route.note.load_session_failed", e, { id });
}

if (!session) {
Expand Down Expand Up @@ -101,7 +102,7 @@ export const Route = createFileRoute("/app/note/$id")({
}
}
} catch (error) {
console.error("Failed to sync participants:", error);
logFrontendError("route.note.sync_participants_failed", error, { id });
}
}

Expand Down Expand Up @@ -150,7 +151,7 @@ function Component() {
queryClient.invalidateQueries({ queryKey: ["sessions"] });
},
onError: (error) => {
console.error(error);
logFrontendError("route.note.delete_session_failed", error, { sessionId });
},
});

Expand Down
3 changes: 2 additions & 1 deletion apps/desktop/src/stores/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { debounce } from "lodash-es";
import type React from "react";
import { createStore } from "zustand";
import { logFrontendError } from "@/logging/frontend-logger";

export type SearchMatch = {
type: "session";
Expand Down Expand Up @@ -131,7 +132,7 @@ export const createSearchStore = (userId: string) => {

setState({ matches, isSearching: false });
} catch (error) {
console.error("Search error:", error);
logFrontendError("search.perform_failed", error, { query });
setState({ isSearching: false });
}
}, 200);
Expand Down
5 changes: 3 additions & 2 deletions apps/desktop/src/utils/tag-generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { commands as connectorCommands } from "@hypr/plugin-connector";
import { commands as dbCommands } from "@hypr/plugin-db";
import { commands as templateCommands, type Grammar } from "@hypr/plugin-template";
import { generateText, localProviderName, modelProvider } from "@hypr/utils/ai";
import { logFrontendError } from "@/logging/frontend-logger";

const extractHashtags = (text: string): string[] => {
const hashtagRegex = /#(\w+)/g;
Expand Down Expand Up @@ -71,7 +72,7 @@ export async function generateTagsForSession(sessionId: string): Promise<string[
const parsed = schema.safeParse(result.text);
return parsed.success ? parsed.data : [];
} catch (error) {
console.error("Tag generation failed:", error);
logFrontendError("tags.generate_for_session_failed", error, { sessionId });
return [];
}
}
Expand Down Expand Up @@ -137,7 +138,7 @@ export async function autoTagGeneration(sessionId: string): Promise<string[]> {
const parsed = schema.safeParse(result.text);
return parsed.success ? parsed.data : [];
} catch (error) {
console.error("Tag generation failed:", error);
logFrontendError("tags.auto_generate_failed", error, { sessionId });
return [];
}
}
5 changes: 3 additions & 2 deletions apps/desktop/src/utils/template-service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Template } from "@hypr/plugin-db";
import { logFrontendError } from "@/logging/frontend-logger";
import { commands as dbCommands } from "@hypr/plugin-db";
import { DEFAULT_TEMPLATES, isDefaultTemplate } from "./default-templates";

Expand All @@ -11,7 +12,7 @@ export class TemplateService {

return [...DEFAULT_TEMPLATES, ...filteredDbTemplates];
} catch (error) {
console.error("Failed to load database templates:", error);
logFrontendError("templates.load_all_failed", error);

return DEFAULT_TEMPLATES;
}
Expand All @@ -27,7 +28,7 @@ export class TemplateService {
const dbTemplates = await dbCommands.listTemplates();
return dbTemplates.find(t => t.id === templateId) || null;
} catch (error) {
console.error("Failed to load database template:", error);
logFrontendError("templates.load_one_failed", error, { templateId });
return null;
}
}
Expand Down