Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix: apply CodeRabbit auto-fixes

coderabbitai[bot]b25a64486c62
diff --git a/apps/web/src/components/ui/error-display.tsx b/apps/web/src/components/ui/error-display.tsx
index 7ed41069b..2e5267ff4 100644
--- a/apps/web/src/components/ui/error-display.tsx
+++ b/apps/web/src/components/ui/error-display.tsx
@@ -55,7 +55,7 @@ export function ErrorDisplay({
</div>
<CardTitle className="text-lg">{resolvedTitle}</CardTitle>
<CardDescription className="text-sm">
- {parsedError.message}
+ {t(parsedError.message)}
</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
@@ -68,7 +68,7 @@ export function ErrorDisplay({
{troubleshootingSteps.map((step) => (
<li key={step} className="flex items-start gap-2">
<span className="text-muted-foreground mt-0.5">•</span>
- <span>{step}</span>
+ <span>{t(step)}</span>
</li>
))}
</ul>
diff --git a/apps/web/src/lib/error-handler.test.ts b/apps/web/src/lib/error-handler.test.ts
index 5a959b73b..507aa5029 100644
--- a/apps/web/src/lib/error-handler.test.ts
+++ b/apps/web/src/lib/error-handler.test.ts
@@ -2,27 +2,27 @@ import { describe, expect, it } from "vitest";
import { parseApiError } from "./error-handler";
describe("parseApiError", () => {
- it("returns a generic message for unknown Error instances instead of leaking error.message", () => {
+ it("returns a generic message key for unknown Error instances instead of leaking error.message", () => {
const internalMessage =
"Cannot read properties of undefined (reading 'id') at TaskList";
const result = parseApiError(new Error(internalMessage));
expect(result.type).toBe("unknown");
- expect(result.message).toBe("An unexpected error occurred.");
+ expect(result.message).toBe("common:error.messages.unknown");
expect(result.message).not.toContain(internalMessage);
// originalError is preserved so Sentry still sees the real cause.
expect(result.originalError?.message).toBe(internalMessage);
});
- it("returns a generic message for non-Error values", () => {
+ it("returns a generic message key for non-Error values", () => {
const result = parseApiError("something bad happened");
expect(result.type).toBe("unknown");
- expect(result.message).toBe("An unexpected error occurred.");
+ expect(result.message).toBe("common:error.messages.unknown");
});
- it("still returns a CORS-specific message for matching errors", () => {
+ it("still returns a CORS-specific message key for matching errors", () => {
const result = parseApiError(new Error("Failed to fetch: CORS blocked"));
expect(result.type).toBe("cors");
- expect(result.message).toContain("CORS");
+ expect(result.message).toBe("common:error.messages.cors");
});
});
diff --git a/apps/web/src/lib/error-handler.ts b/apps/web/src/lib/error-handler.ts
index 9db58617e..277ac4b50 100644
--- a/apps/web/src/lib/error-handler.ts
+++ b/apps/web/src/lib/error-handler.ts
@@ -13,8 +13,7 @@ export function parseApiError(error: unknown): ApiError {
error.message.includes("CORS")
) {
return {
- message:
- "Unable to connect to the server. This might be due to CORS configuration issues.",
+ message: "common:error.messages.cors",
type: "cors",
originalError: error,
};
@@ -26,8 +25,7 @@ export function parseApiError(error: unknown): ApiError {
error.message.includes("connection")
) {
return {
- message:
- "Network error. Please check your internet connection and try again.",
+ message: "common:error.messages.network",
type: "network",
originalError: error,
};
@@ -39,7 +37,7 @@ export function parseApiError(error: unknown): ApiError {
error.message.includes("authentication")
) {
return {
- message: "Authentication failed. Please sign in again.",
+ message: "common:error.messages.auth",
type: "auth",
status: 401,
originalError: error,
@@ -53,7 +51,7 @@ export function parseApiError(error: unknown): ApiError {
error.message.includes("internal")
) {
return {
- message: "Server error. Please try again later.",
+ message: "common:error.messages.server",
type: "server",
status: 500,
originalError: error,
@@ -66,33 +64,33 @@ export function parseApiError(error: unknown): ApiError {
// the latter can leak internal implementation details to end users.
// The original error is preserved on `originalError` for Sentry.
return {
- message: "An unexpected error occurred.",
+ message: "common:error.messages.unknown",
type: "unknown",
originalError: error,
};
}
return {
- message: "An unexpected error occurred.",
+ message: "common:error.messages.unknown",
type: "unknown",
};
}
export function getCorsTroubleshootingSteps(): string[] {
return [
- "Make sure your API server is running",
- "Check that VITE_API_URL in your frontend .env matches your API server URL",
- "Verify CORS_ORIGINS in your API .env includes your frontend URL",
- "Ensure both frontend and API are using the same protocol (http/https)",
- "Check that your API server is accessible from your browser",
+ "common:error.troubleshootingSteps.cors.checkApiRunning",
+ "common:error.troubleshootingSteps.cors.checkApiUrl",
+ "common:error.troubleshootingSteps.cors.verifyCorsOrigins",
+ "common:error.troubleshootingSteps.cors.checkProtocol",
+ "common:error.troubleshootingSteps.cors.checkAccessibility",
];
}
export function getNetworkTroubleshootingSteps(): string[] {
return [
- "Check your internet connection",
- "Verify the API server is running and accessible",
- "Try refreshing the page",
- "Check if there are any firewall or proxy issues",
+ "common:error.troubleshootingSteps.network.checkConnection",
+ "common:error.troubleshootingSteps.network.verifyApiRunning",
+ "common:error.troubleshootingSteps.network.tryRefresh",
+ "common:error.troubleshootingSteps.network.checkFirewall",
];
}
diff --git a/i18n/en-US.json b/i18n/en-US.json
index 7201e68d5..25efb6279 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -57,7 +57,29 @@
"troubleshooting": "Troubleshooting steps:",
"tryAgain": "Try Again",
"viewDeploymentGuide": "View Deployment Guide",
- "refreshPage": "Refresh Page"
+ "refreshPage": "Refresh Page",
+ "messages": {
+ "cors": "Unable to connect to the server. This might be due to CORS configuration issues.",
+ "network": "Network error. Please check your internet connection and try again.",
+ "auth": "Authentication failed. Please sign in again.",
+ "server": "Server error. Please try again later.",
+ "unknown": "An unexpected error occurred."
+ },
+ "troubleshootingSteps": {
+ "cors": {
+ "checkApiRunning": "Make sure your API server is running",
+ "checkApiUrl": "Check that VITE_API_URL in your frontend .env matches your API server URL",
+ "verifyCorsOrigins": "Verify CORS_ORIGINS in your API .env includes your frontend URL",
+ "checkProtocol": "Ensure both frontend and API are using the same protocol (http/https)",
+ "checkAccessibility": "Check that your API server is accessible from your browser"
+ },
+ "network": {
+ "checkConnection": "Check your internet connection",
+ "verifyApiRunning": "Verify the API server is running and accessible",
+ "tryRefresh": "Try refreshing the page",
+ "checkFirewall": "Check if there are any firewall or proxy issues"
+ }
+ }
},
"formats": {
"never": "Never"