6ede33ccdb
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / compute_version (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Blocked by required conditions
Build and Push Docker Images / verify_digests (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Blocked by required conditions
Build and Push Docker Images / finalize_release (push) Blocked by required conditions
Obsidian Plugin Lint / lint (push) Waiting to run
73 lines
2.3 KiB
TypeScript
73 lines
2.3 KiB
TypeScript
import { toast } from "sonner";
|
|
import { AbortedError, AppError, AuthenticationError, SURFSENSE_ISSUES_URL } from "./error";
|
|
|
|
/**
|
|
* Build a GitHub issue URL pre-filled with diagnostic context.
|
|
* Avoids including PII — only structural metadata.
|
|
*/
|
|
export function buildIssueUrl(error: unknown): string {
|
|
const params = new URLSearchParams();
|
|
|
|
const lines: string[] = ["## Bug Report", "", "**Describe what happened:**", "", ""];
|
|
|
|
if (error instanceof AppError) {
|
|
lines.push("## Diagnostics (auto-filled)", "");
|
|
if (error.code) lines.push(`- **Error code:** \`${error.code}\``);
|
|
if (error.requestId) lines.push(`- **Request ID:** \`${error.requestId}\``);
|
|
if (error.status) lines.push(`- **HTTP status:** ${error.status}`);
|
|
lines.push(`- **Message:** ${error.message}`);
|
|
} else if (error instanceof Error) {
|
|
lines.push("## Diagnostics (auto-filled)", "");
|
|
lines.push(`- **Error:** ${error.message}`);
|
|
}
|
|
|
|
lines.push(`- **Timestamp:** ${new Date().toISOString()}`);
|
|
lines.push(
|
|
`- **Page:** \`${typeof window !== "undefined" ? window.location.pathname : "unknown"}\``
|
|
);
|
|
lines.push(
|
|
`- **User Agent:** \`${typeof navigator !== "undefined" ? navigator.userAgent : "unknown"}\``
|
|
);
|
|
|
|
params.set("body", lines.join("\n"));
|
|
params.set("labels", "bug");
|
|
|
|
return `${SURFSENSE_ISSUES_URL}/new?${params.toString()}`;
|
|
}
|
|
|
|
/**
|
|
* Show a standardized error toast with a "Report Issue" action.
|
|
*
|
|
* Suppressed for:
|
|
* - AbortedError (user-initiated cancellation)
|
|
* - AuthenticationError (handled by redirect)
|
|
*/
|
|
export function showErrorToast(error: unknown, fallbackMessage?: string) {
|
|
if (error instanceof AbortedError || error instanceof AuthenticationError) {
|
|
return;
|
|
}
|
|
|
|
const message =
|
|
error instanceof AppError
|
|
? error.message
|
|
: error instanceof Error
|
|
? error.message
|
|
: (fallbackMessage ?? "An unexpected error occurred.");
|
|
|
|
const code = error instanceof AppError ? error.code : undefined;
|
|
const requestId = error instanceof AppError ? error.requestId : undefined;
|
|
|
|
const descParts: string[] = [];
|
|
if (code) descParts.push(`Error: ${code}`);
|
|
if (requestId) descParts.push(`ID: ${requestId}`);
|
|
|
|
toast.error(message, {
|
|
description: descParts.length > 0 ? descParts.join(" | ") : undefined,
|
|
duration: 8000,
|
|
action: {
|
|
label: "Report Issue",
|
|
onClick: () => window.open(buildIssueUrl(error), "_blank"),
|
|
},
|
|
});
|
|
}
|