fix(ui/org): failures read from the error catalogue

This commit is contained in:
sam committed 2026-11-13 13:41:32 +11:00
1 parent cdd636d5aa
commit 47a340bf79
47 files changed
+236 -104

No files matched your search

+4 -3
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
import { errors } from "@/copy/errors";
import { useRoute, useRouter } from "vue-router";
import AccountEntry from "@/accounts/AccountEntry.vue";
@@ -46,7 +47,7 @@ watch([() => route.path, hidden], () => {
});
watch(() => [route.path, accounts.instance], () => {
const scope = route.meta.org ? "Organisation" : route.meta.settings ? "Instance" : "";
document.title = [route.meta.label || "Page not found", scope, "Archie", accounts.instance].filter(Boolean).join(" | ");
document.title = [route.meta.label || errors.base.notFound.title, scope, "Archie", accounts.instance].filter(Boolean).join(" | ");
}, { immediate: true });
watch(() => route.path, async () => {
await nextTick();
@@ -85,9 +86,9 @@ watch(() => accounts.status?.user, (user) => {
<Card class="gap-0 px-6 py-6 shadow-sm">
<div class="mb-2"><Logo /></div>
<template v-if="accounts.error">
<h1 class="text-title font-medium">Can't reach Archie</h1>
<h1 class="text-title font-medium">{{ errors.app.unreachable }}</h1>
<Alert variant="destructive" class="mt-4"><AlertDescription>{{ accounts.error }}</AlertDescription></Alert>
<p class="text-caption mt-3 text-fg-muted">Retrying automatically…</p>
<p class="text-caption mt-3 text-fg-muted">{{ errors.app.retrying }}</p>
</template>
<p v-else class="mt-2" role="status">Connecting to Archie…</p>
</Card>
+4 -3
View File
@@ -6,7 +6,8 @@ import { computed, ref } from "vue";
import { Card } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { passkeysAvailable, useAccountsStore, usePasskey } from "./accounts";
const accounts=useAccountsStore();
const step=ref(1);const recovery=ref(false);const recoveryCode=ref("");
@@ -23,10 +24,10 @@ async function submit(){
else await api.signIn(email.value,password.value);
password.value="";
window.location.assign(setup.value?"/account?welcome=1":new URLSearchParams(window.location.search).has("reauth")?"/account":"/");
}catch(cause){error.value=String((cause as Error).message||cause);await accounts.load()}
}catch(cause){error.value=describeError(cause, errors.common.unknown);await accounts.load()}
finally{busy.value=false}
}
async function signInPasskey(){busy.value=true;error.value="";try{await usePasskey(false);window.location.assign("/")}catch(cause){error.value=String((cause as Error).message||cause)}finally{busy.value=false}}
async function signInPasskey(){busy.value=true;error.value="";try{await usePasskey(false);window.location.assign("/")}catch(cause){error.value=describeError(cause, errors.common.unknown)}finally{busy.value=false}}
</script>
<template>
<main class="mx-auto flex min-h-[90dvh] max-w-md flex-col justify-center px-5 py-10">
+4 -3
View File
@@ -10,15 +10,16 @@ import { Card } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { SettingRow } from "@/components/ui/setting-row";
import { Section } from "@/components/ui/section";
import { api, classifyActionError } from "@/lib/api";
import { api, classifyActionError, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { passkeysAvailable,useAccountsStore,usePasskey } from "./accounts";
const recovery=ref("");
const makeRecovery=()=>run(async()=>{recovery.value=(await api.recoveryCode()).code});
const accounts=useAccountsStore();const keys=ref<{id:string;name:string}[]>([]);const pending=ref<{id:string;name:string}|null>(null);const error=ref("");const sessionExpired=ref(false);const busy=ref(false);const keyName=ref("");const current=ref("");const next=ref("");
const eligible=computed(()=>passkeysAvailable(accounts.status?.public_url??""));
async function load(){try{keys.value=(await api.passkeys()).passkeys}catch(cause){error.value=String((cause as Error).message||cause);sessionExpired.value=classifyActionError(cause).kind==="session-expired"}}
async function load(){try{keys.value=(await api.passkeys()).passkeys}catch(cause){error.value=describeError(cause, errors.common.unknown);sessionExpired.value=classifyActionError(cause).kind==="session-expired"}}
onMounted(load);
async function run(action:()=>Promise<unknown>){busy.value=true;error.value="";try{await action()}catch(cause){error.value=String((cause as Error).message||cause);sessionExpired.value=classifyActionError(cause).kind==="session-expired"}finally{busy.value=false}}
async function run(action:()=>Promise<unknown>){busy.value=true;error.value="";try{await action()}catch(cause){error.value=describeError(cause, errors.common.unknown);sessionExpired.value=classifyActionError(cause).kind==="session-expired"}finally{busy.value=false}}
const enroll=()=>run(async()=>{await usePasskey(true,keyName.value);keyName.value="";await load()});
const remove=(id:string)=>run(async()=>{await api.deletePasskey(id);await load()});
const change=()=>run(async()=>{await api.changePassword(current.value,next.value);current.value=next.value="";window.location.assign("/")});
+4 -3
View File
@@ -7,15 +7,16 @@ import PageHeader from "@/base/PageHeader.vue";
import { Button } from "@/components/ui/button";
import CodeView from "@/base/CodeView.vue";
import { Input } from "@/components/ui/input";
import { api, classifyActionError } from "@/lib/api";
import { api, classifyActionError, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { SettingRow } from "@/components/ui/setting-row";
import { Section } from "@/components/ui/section";
interface Settings {public_url:string;oidc_issuer:string;oidc_audience:string;oidc_client_id:string}
const value=ref<Settings>({public_url:"",oidc_issuer:"",oidc_audience:"",oidc_client_id:""});const loaded=ref(false);const error=ref("");const sessionExpired=ref(false);const busy=ref(false);const saved=ref(false);
async function load(){try{value.value=await api.authentication<Settings>();loaded.value=true;error.value=""}catch(cause){error.value=String((cause as Error).message||cause)}finally{loaded.value=true}}
async function load(){try{value.value=await api.authentication<Settings>();loaded.value=true;error.value=""}catch(cause){error.value=describeError(cause, errors.common.unknown)}finally{loaded.value=true}}
onMounted(load);
const redirectURI=computed(()=>`${value.value.public_url.replace(/\/$/,"")}/oauth2/callback`);
async function save(){busy.value=true;error.value="";saved.value=false;try{await api.saveAuthentication(value.value);saved.value=true}catch(cause){error.value=String((cause as Error).message||cause);sessionExpired.value=classifyActionError(cause).kind==="session-expired"}finally{busy.value=false}}
async function save(){busy.value=true;error.value="";saved.value=false;try{await api.saveAuthentication(value.value);saved.value=true}catch(cause){error.value=describeError(cause, errors.common.unknown);sessionExpired.value=classifyActionError(cause).kind==="session-expired"}finally{busy.value=false}}
</script>
<template>
<div><PageHeader title="Authentication"/>
+3 -2
View File
@@ -6,13 +6,14 @@ import { Input } from "@/components/ui/input";
import { Section } from "@/components/ui/section";
import { Button } from "@/components/ui/button";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { api, classifyActionError } from "@/lib/api";
import { api, classifyActionError, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { ROLE_LABELS, ROLES } from "@/org/org";
const emit=defineEmits<{created:[]}>();
// Owner is granted from the member table, not when creating an account.
const assignable = ROLES.filter((role) => role !== "owner");
const name=ref("");const email=ref("");const password=ref("");const role=ref("viewer");const busy=ref(false);const error=ref("");const sessionExpired=ref(false);
async function create(){busy.value=true;error.value="";try{await api.createAccount({display_name:name.value,email:email.value,password:password.value,role:role.value});name.value=email.value=password.value="";emit("created")}catch(cause){error.value=String((cause as Error).message||cause);sessionExpired.value=classifyActionError(cause).kind==="session-expired"}finally{busy.value=false}}
async function create(){busy.value=true;error.value="";try{await api.createAccount({display_name:name.value,email:email.value,password:password.value,role:role.value});name.value=email.value=password.value="";emit("created")}catch(cause){error.value=describeError(cause, errors.common.unknown);sessionExpired.value=classifyActionError(cause).kind==="session-expired"}finally{busy.value=false}}
</script>
<template>
<Section title="Create a local account">
+3 -2
View File
@@ -10,7 +10,8 @@ import { Card } from "@/components/ui/card";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { Section } from "@/components/ui/section";
import { Timestamp } from "@/components/ui/timestamp";
@@ -43,7 +44,7 @@ async function run(action: () => Promise<void>): Promise<void> {
await action();
error.value = "";
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
} finally {
busy.value = false;
}
+5 -4
View File
@@ -1,14 +1,15 @@
import { defineStore } from "pinia";
import { computed, ref } from "vue";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
export interface AccountUser {id:string;display_name:string;kind:string}
interface AuthStatus {setup_required:boolean;user:AccountUser|null;oidc:boolean;public_url:string;instance?:string}
export const useAccountsStore=defineStore("accounts",()=>{
const status=ref<AuthStatus|null>(null);
const error=ref("");
async function load():Promise<void>{try{status.value=await api.authStatus<AuthStatus>();error.value=""}catch(cause){error.value=String((cause as Error).message||cause)}}
async function signOut():Promise<void>{try{await api.signOut()}catch(cause){error.value=String((cause as Error).message||cause);return}window.location.assign("/")}
async function load():Promise<void>{try{status.value=await api.authStatus<AuthStatus>();error.value=""}catch(cause){error.value=describeError(cause, errors.common.unknown)}}
async function signOut():Promise<void>{try{await api.signOut()}catch(cause){error.value=describeError(cause, errors.common.unknown);return}window.location.assign("/")}
// Empty for the default instance, which needs no label.
const instance=computed(()=>{const name=status.value?.instance||"";return name==="archie"?"":name});
return {status,error,instance,load,signOut};
@@ -35,7 +36,7 @@ export async function usePasskey(registration:boolean,name=""):Promise<void>{
if(registration){const user=key.user as Record<string,unknown>;user.id=decode(user.id as string)}
for(const list of ["excludeCredentials","allowCredentials"]){for(const entry of (key[list] as {id:string|ArrayBuffer}[]|undefined)??[]){entry.id=decode(entry.id as string)}}
const credential=(registration?await navigator.credentials.create({publicKey:key as unknown as PublicKeyCredentialCreationOptions}):await navigator.credentials.get({publicKey:key as unknown as PublicKeyCredentialRequestOptions})) as PublicKeyCredential|null;
if(!credential)throw new Error("No passkey was selected.");
if(!credential)throw new Error(errors.accounts.passkey.noneSelected);
const response=credential.response;
const common={clientDataJSON:encode(response.clientDataJSON)};
const data=response instanceof AuthenticatorAttestationResponse?{...common,attestationObject:encode(response.attestationObject),transports:response.getTransports()}:{...common,authenticatorData:encode((response as AuthenticatorAssertionResponse).authenticatorData),signature:encode((response as AuthenticatorAssertionResponse).signature),userHandle:encode((response as AuthenticatorAssertionResponse).userHandle)};
+4 -3
View File
@@ -3,6 +3,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { computed, ref } from "vue";
import { errors } from "@/copy/errors";
import { Bell, CheckCheck, X } from "@lucide/vue";
import { RouterLink } from "vue-router";
@@ -42,8 +43,8 @@ function failedDeliveries(alert: OperatorAlert): number {
</Button>
</PopoverTrigger>
<PopoverContent align="end" :collision-padding="8" class="w-[calc(100vw-1rem)] max-w-none p-0 sm:w-96">
<Alert v-if="failed" variant="destructive" class="px-3 py-6 text-center"><AlertDescription>Alerts could not be loaded.</AlertDescription></Alert>
<Alert v-if="dismissError" variant="destructive" class="px-3 py-2"><AlertDescription>Dismiss failed: {{ dismissError }}</AlertDescription></Alert>
<Alert v-if="failed" variant="destructive" class="px-3 py-6 text-center"><AlertDescription>{{ errors.alerts.load }}</AlertDescription></Alert>
<Alert v-if="dismissError" variant="destructive" class="px-3 py-2"><AlertDescription>{{ dismissError }}</AlertDescription></Alert>
<p v-else-if="!loaded" class="px-3 py-6 text-center text-label text-fg-muted" role="status">Loading alerts…</p>
<Empty v-else-if="!groups.length" class="border-0"><EmptyHeader><EmptyTitle>No alerts</EmptyTitle></EmptyHeader></Empty>
<div v-else class="relative max-h-[calc(100dvh-6rem)] overflow-y-auto">
@@ -74,7 +75,7 @@ function failedDeliveries(alert: OperatorAlert): number {
>
<span class="text-label font-medium group-hover:underline">{{ alert.title }}</span>
<span v-if="alert.body" class="text-label leading-snug text-fg-muted">{{ alert.body }}</span>
<span v-if="failedDeliveries(alert)" class="text-caption text-warn">Webhook delivery failed.</span>
<span v-if="failedDeliveries(alert)" class="text-caption text-warn">{{ errors.alerts.webhookDelivery }}</span>
</component>
<Timestamp :at="alert.first_raised" class="mt-0.5 shrink-0 text-caption whitespace-nowrap text-fg-subtle" />
<Tooltip>
+4 -3
View File
@@ -1,7 +1,8 @@
import { storeToRefs } from "pinia";
import { onMounted, ref, watch } from "vue";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { useSessionStore } from "@/stores/session";
import type { OperatorAlert } from "./alerts";
@@ -52,7 +53,7 @@ async function dismiss(alert: OperatorAlert) {
alerts.value = alerts.value.filter((a) => a.id !== alert.id);
} catch (err) {
// The dismiss failed: the alert stays and the reason is shown.
dismissError.value = String((err as Error).message || err);
dismissError.value = errors.alerts.dismiss(describeError(err, errors.common.unknown));
await load();
}
}
@@ -63,7 +64,7 @@ async function dismissAll() {
const results = await Promise.allSettled(ids.map((id) => api.dismissAlert(id)));
const rejected = results.find((r) => r.status === "rejected");
if (rejected && rejected.status === "rejected") {
dismissError.value = String((rejected.reason as Error)?.message || rejected.reason);
dismissError.value = errors.alerts.dismiss(describeError(rejected.reason, errors.common.unknown));
await load();
return;
}
+9 -7
View File
@@ -4,6 +4,8 @@ import { ReadError } from "@/components/ui/read-error";
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import { storeToRefs } from "pinia";
import { errors } from "@/copy/errors";
import { describeError } from "@/lib/api";
import { useAccountsStore } from "@/accounts/accounts";
import PageHeader from "@/base/PageHeader.vue";
@@ -155,8 +157,8 @@ async function pullLive(): Promise<void> {
status.value = `${merged.length} new ${merged.length === 1 ? "event" : "events"}`;
}
} catch (err) {
liveError.value = String((err as Error)?.message || err || "Audit could not refresh.");
status.value = "Audit could not refresh.";
liveError.value = describeError(err, errors.audit.refresh);
status.value = errors.audit.refresh;
lastToken = null;
} finally {
liveBusy = false;
@@ -296,21 +298,21 @@ async function confirmRevert(): Promise<void> {
try {
await settings.loadResource(target.kind);
if (!settings.stateFor(target.kind).resource) {
revertError.value = "That resource could not be loaded.";
revertError.value = errors.audit.revert.resourceLoad;
return;
}
const previous = (await settings.history(target.kind)).find(
(revision) => revision.version === version - 1,
);
if (!previous) {
revertError.value = "That earlier version is no longer available.";
revertError.value = errors.audit.revert.unavailable;
return;
}
settings.stageRestore(target.kind, previous.value);
revertTarget.value = null;
revertOpen.value = false;
} catch (err) {
revertError.value = String((err as Error)?.message || err);
revertError.value = describeError(err, errors.common.unknown);
} finally {
reverting.value = false;
}
@@ -415,7 +417,7 @@ async function saveRetention(): Promise<void> {
}
const state = retentionState;
if (!state.resource) {
retentionError.value = "Retention settings are unavailable.";
retentionError.value = errors.audit.retention.unavailable;
return;
}
retentionSaving.value = true;
@@ -426,7 +428,7 @@ async function saveRetention(): Promise<void> {
const saved = await settings.replace(RETENTION_KIND, value, state.resource.version);
retentionSaving.value = false;
if (saved) retentionOpen.value = false;
else retentionError.value = state.error || "Retention could not be saved.";
else retentionError.value = state.error || errors.audit.retention.save;
}
</script>
+4 -4
View File
@@ -1,7 +1,8 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import { ApiError, api, type QueryParams } from "@/lib/api";
import { errors } from "@/copy/errors";
import { ApiError, api, describeError, type QueryParams } from "@/lib/api";
import {
apiParams,
dedupeRecords,
@@ -16,9 +17,8 @@ import {
const PAGE_SIZE = 100;
function failure(err: unknown): string {
if (err instanceof ApiError && err.status === 503) return "Audit is unavailable.";
const message = err instanceof Error && err.message ? err.message : String(err);
return message || "Audit could not be loaded.";
if (err instanceof ApiError && err.status === 503) return errors.audit.unavailable;
return describeError(err, errors.audit.load);
}
/** The server's vocabularies arrive with the first page; a later page that
+3 -2
View File
@@ -1,14 +1,15 @@
<script setup lang="ts">
import PageHeader from "./PageHeader.vue";
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { errors } from "@/copy/errors";
</script>
<template>
<div>
<PageHeader title="Page not found" />
<PageHeader :title="errors.base.notFound.title" />
<Empty>
<EmptyHeader>
<EmptyTitle>No page at this address</EmptyTitle>
<EmptyTitle>{{ errors.base.notFound.address }}</EmptyTitle>
<EmptyDescription><RouterLink to="/">Return to dashboard</RouterLink></EmptyDescription>
</EmptyHeader>
</Empty>
+5 -3
View File
@@ -12,13 +12,15 @@ import {
} from "@/components/ui/dropdown-menu";
import { SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar } from "@/components/ui/sidebar";
import { useOrgStore } from "@/stores/org";
import { errors } from "@/copy/errors";
import { describeError } from "@/lib/api";
const orgStore = useOrgStore();
const { homeOrg, memberOrgs, orgs } = storeToRefs(orgStore);
const { isMobile } = useSidebar();
const failed = ref("");
onMounted(() => void orgStore.loadOrg().catch((cause) => (failed.value = String((cause as Error).message || cause))));
onMounted(() => void orgStore.loadOrg().catch((cause) => (failed.value = describeError(cause, errors.common.unknown))));
const choices = computed(() => orgs.value.filter((o) => memberOrgs.value.includes(o.id)));
const active = computed(() => orgs.value.find((o) => o.id === homeOrg.value));
@@ -30,7 +32,7 @@ async function choose(id: string): Promise<void> {
try {
await orgStore.actInOrg(id);
} catch (cause) {
failed.value = String((cause as Error).message || cause);
failed.value = describeError(cause, errors.common.unknown);
}
}
</script>
@@ -50,7 +52,7 @@ async function choose(id: string): Promise<void> {
{{ active ? initial(active.name) : failed ? "!" : "…" }}
</div>
<div class="grid flex-1 text-left leading-tight">
<span class="truncate text-label font-medium">{{ active?.name ?? (failed ? "Organisations unavailable" : "Loading…") }}</span>
<span class="truncate text-label font-medium">{{ active?.name ?? (failed ? errors.components.org.unavailable : "Loading…") }}</span>
</div>
<ChevronsUpDown v-if="choices.length > 1" class="ml-auto" aria-hidden="true" />
</SidebarMenuButton>
@@ -14,6 +14,7 @@ import {
} from "@/components/ui/command";
import { Kbd } from "@/components/ui/kbd";
import { api } from "@/lib/api";
import { errors } from "@/copy/errors";
import { navEntries } from "@/lib/nav";
import { statusLabel } from "@/lib/task-meta";
@@ -125,7 +126,7 @@ onUnmounted(() => document.removeEventListener("keydown", onGlobalKeydown));
</CommandItem>
</CommandGroup>
<CommandGroup v-if="workflowsError" heading="Workflows">
<CommandItem value="workflows-error" @select="loadEntries">Couldn't load workflows — Retry</CommandItem>
<CommandItem value="workflows-error" @select="loadEntries">{{ errors.components.commandPalette.workflows }}</CommandItem>
</CommandGroup>
<CommandGroup v-else-if="workflows.length" heading="Workflows">
<CommandItem
@@ -138,7 +139,7 @@ onUnmounted(() => document.removeEventListener("keydown", onGlobalKeydown));
</CommandItem>
</CommandGroup>
<CommandGroup v-if="tasksError" heading="Tasks">
<CommandItem value="tasks-error" @select="loadEntries">Couldn't load tasks — Retry</CommandItem>
<CommandItem value="tasks-error" @select="loadEntries">{{ errors.components.commandPalette.tasks }}</CommandItem>
</CommandGroup>
<CommandGroup v-else-if="tasks.length" heading="Tasks">
<CommandItem
+5 -3
View File
@@ -11,16 +11,18 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { useOrgStore } from "@/stores/org";
import { errors } from "@/copy/errors";
import { describeError } from "@/lib/api";
import { useHoverOpen } from "./hover-open";
const orgStore = useOrgStore();
const { homeOrg, memberOrgs, orgs } = storeToRefs(orgStore);
const failed = ref("");
onMounted(() => void orgStore.loadOrg().catch((cause) => (failed.value = String((cause as Error).message || cause))));
onMounted(() => void orgStore.loadOrg().catch((cause) => (failed.value = describeError(cause, errors.common.unknown))));
const choices = computed(() => orgs.value.filter((o) => memberOrgs.value.includes(o.id)));
const name = computed(() => orgs.value.find((o) => o.id === homeOrg.value)?.name ?? (failed.value ? "Organisations unavailable" : "Loading…"));
const name = computed(() => orgs.value.find((o) => o.id === homeOrg.value)?.name ?? (failed.value ? errors.components.org.unavailable : "Loading…"));
async function choose(id: string): Promise<void> {
if (id === homeOrg.value) return;
@@ -28,7 +30,7 @@ async function choose(id: string): Promise<void> {
try {
await orgStore.actInOrg(id);
} catch (cause) {
failed.value = String((cause as Error).message || cause);
failed.value = describeError(cause, errors.common.unknown);
}
}
+5
View File
@@ -0,0 +1,5 @@
export const accounts = {
passkey: {
noneSelected: "No passkey was selected.",
},
} as const;
+5
View File
@@ -0,0 +1,5 @@
export const alerts = {
load: "Alerts could not be loaded.",
dismiss: (detail: string) => `Dismiss failed: ${detail}`,
webhookDelivery: "Webhook delivery failed.",
} as const;
+4
View File
@@ -0,0 +1,4 @@
export const app = {
unreachable: "Can't reach Archie",
retrying: "Retrying automatically…",
} as const;
+13
View File
@@ -0,0 +1,13 @@
export const audit = {
unavailable: "Audit is unavailable.",
load: "Audit could not be loaded.",
refresh: "Audit could not refresh.",
revert: {
resourceLoad: "That resource could not be loaded.",
unavailable: "That earlier version is no longer available.",
},
retention: {
unavailable: "Retention settings are unavailable.",
save: "Retention could not be saved.",
},
} as const;
+6
View File
@@ -0,0 +1,6 @@
export const base = {
notFound: {
title: "Page not found",
address: "No page at this address",
},
} as const;
+9
View File
@@ -0,0 +1,9 @@
export const components = {
org: {
unavailable: "Organisations unavailable",
},
commandPalette: {
workflows: "Couldn't load workflows — Retry",
tasks: "Couldn't load tasks — Retry",
},
} as const;
+22
View File
@@ -1,28 +1,50 @@
// Every failure message the dashboard writes itself, by feature. Call sites
// dot-walk it, e.g. errors.chat.composer.microphoneUnavailable, so the copy is
// changed here and nowhere else.
import { accounts } from "./accounts.ts";
import { alerts } from "./alerts.ts";
import { app } from "./app.ts";
import { audit } from "./audit.ts";
import { base } from "./base.ts";
import { captures } from "./captures.ts";
import { channels } from "./channels.ts";
import { chat } from "./chat.ts";
import { common } from "./common.ts";
import { components } from "./components.ts";
import { curators } from "./curators.ts";
import { dashboard } from "./dashboard.ts";
import { events } from "./events.ts";
import { lib } from "./lib.ts";
import { logs } from "./logs.ts";
import { org } from "./org.ts";
import { router } from "./router.ts";
import { settings } from "./settings.ts";
import { skills } from "./skills.ts";
import { sources } from "./sources.ts";
import { stores } from "./stores.ts";
import { tasks } from "./tasks.ts";
export const errors = {
accounts,
alerts,
app,
audit,
base,
captures,
channels,
chat,
common,
components,
curators,
dashboard,
events,
lib,
logs,
org,
router,
settings,
skills,
sources,
stores,
tasks,
} as const;
+3
View File
@@ -0,0 +1,3 @@
// lib/ writes no failure copy of its own: the WebMCP tool errors are read by the
// calling agent, not shown in the dashboard.
export const lib = {} as const;
+5
View File
@@ -0,0 +1,5 @@
export const org = {
identities: {
unavailable: "Unavailable identity",
},
} as const;
+2
View File
@@ -0,0 +1,2 @@
// router/ writes no failure copy of its own.
export const router = {} as const;
+11
View File
@@ -0,0 +1,11 @@
export const settings = {
channels: {
status: "Couldn't load channel status",
},
repos: {
checkFailed: "Check failed",
},
status: {
reload: "Configuration reload failed",
},
} as const;
+8
View File
@@ -0,0 +1,8 @@
export const stores = {
denials: {
unavailable: "Denial records are unavailable.",
},
settings: {
conflict: "Changed elsewhere. Latest values loaded.",
},
} as const;
+3 -2
View File
@@ -20,7 +20,8 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { useOrgStore } from "@/stores/org";
import type { Org } from "./org";
@@ -55,7 +56,7 @@ async function create(): Promise<void> {
open.value = false;
id.value = name.value = owner.value = error.value = "";
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
} finally {
busy.value = false;
}
+5 -4
View File
@@ -18,7 +18,8 @@ import {
SelectValue,
} from "@/components/ui/select";
import { Textarea } from "@/components/ui/textarea";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
type Level = "instance" | "org" | "workspace" | "object";
@@ -113,7 +114,7 @@ async function load(): Promise<void> {
shipped.value = response.shipped;
error.value = null;
} catch (err) {
error.value = (err as Error).message;
error.value = describeError(err, errors.common.unknown);
} finally {
loading.value = false;
}
@@ -140,7 +141,7 @@ async function save(): Promise<void> {
editingExisting.value = false;
await load();
} catch (err) {
saveError.value = (err as Error).message;
saveError.value = describeError(err, errors.common.unknown);
} finally {
saving.value = false;
}
@@ -152,7 +153,7 @@ async function remove(p: Policy): Promise<void> {
await api.deletePolicy(p);
await load();
} catch (err) {
error.value = (err as Error).message;
error.value = describeError(err, errors.common.unknown);
}
}
+5 -4
View File
@@ -32,7 +32,8 @@ import { Badge } from "@/components/ui/badge";
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
import { MoreMenu } from "@/components/ui/more-menu";
import { Section } from "@/components/ui/section";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { useOrgStore, type Identity } from "@/stores/org";
// Agent assignment is independent of membership roles.
@@ -54,7 +55,7 @@ async function load(): Promise<void> {
serves.value = new Set(response.agents.map((agent) => agent.id));
error.value = "";
} catch (cause) {
if (org.value?.id === id) error.value = String((cause as Error).message || cause);
if (org.value?.id === id) error.value = describeError(cause, errors.common.unknown);
}
}
@@ -62,7 +63,7 @@ onMounted(async () => {
try {
await store.loadOrg();
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
return;
}
await load();
@@ -98,7 +99,7 @@ async function assign(value: Identity): Promise<void> {
serves.value = new Set([...serves.value, value.id]);
error.value = "";
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
} finally {
busy.value = "";
}
+5 -4
View File
@@ -27,7 +27,8 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { useOrgStore } from "@/stores/org";
import { ROLE_LABELS, ROLES, type Member, type Role } from "./org";
@@ -58,7 +59,7 @@ async function load(): Promise<void> {
).members;
error.value = "";
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
}
}
@@ -68,7 +69,7 @@ onMounted(async () => {
identities.watchIdentities();
await load();
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
} finally {
loading.value = false;
}
@@ -91,7 +92,7 @@ async function run(key: string, action: () => Promise<void>): Promise<void> {
await action();
error.value = "";
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
} finally {
busy.value = "";
}
+3 -1
View File
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { errors } from "@/copy/errors";
import { describeError } from "@/lib/api";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { storeToRefs } from "pinia";
import { computed, onMounted, ref, watch } from "vue";
@@ -30,7 +32,7 @@ onMounted(async () => {
try {
await orgStore.loadOrg();
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
}
});
</script>
+3 -2
View File
@@ -15,7 +15,8 @@ import {
SelectValue,
} from "@/components/ui/select";
import { Spinner } from "@/components/ui/spinner";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { compact, usd } from "@/lib/format";
/**
@@ -73,7 +74,7 @@ async function load(): Promise<void> {
report.value = next;
} catch (cause) {
if (attempt !== revision) return;
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
} finally {
if (attempt === revision) loading.value = false;
}
+5 -4
View File
@@ -17,7 +17,8 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { useOrgStore } from "@/stores/org";
import type { OrgWorkspace } from "./org";
@@ -42,7 +43,7 @@ async function load(): Promise<void> {
).workspaces;
error.value = "";
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
}
}
@@ -51,7 +52,7 @@ onMounted(async () => {
await orgStore.loadOrg();
await load();
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
} finally {
loading.value = false;
}
@@ -72,7 +73,7 @@ async function create(): Promise<void> {
error.value = "";
await load();
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
} finally {
busy.value = false;
}
+2 -1
View File
@@ -29,6 +29,7 @@ import {
TagsInputItemText,
} from "@/components/ui/tags-input";
import { api } from "@/lib/api";
import { errors } from "@/copy/errors";
import { Section } from "@/components/ui/section";
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
import { useLiveResource } from "@/stores/session";
@@ -110,7 +111,7 @@ function setModels(list: string[]) {
<Alert v-if="extensions.error" variant="destructive" class="mb-4"><AlertDescription>{{ extensions.error }}</AlertDescription></Alert>
<Alert v-if="statusError" variant="destructive" class="mb-4"><AlertDescription>
Couldn't load channel status
{{ errors.settings.channels.status }}
<Button variant="link" size="xs" @click="loadStatus">Retry</Button>
</AlertDescription></Alert>
+3 -1
View File
@@ -11,6 +11,8 @@ import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemTitle } from "@/components/ui/item";
import NewOrgDialog from "@/org/NewOrgDialog.vue";
import { useOrgStore } from "@/stores/org";
import { errors } from "@/copy/errors";
import { describeError } from "@/lib/api";
/**
* The instance's tenants. Creating an org is an instance decision, so it lives
@@ -26,7 +28,7 @@ onMounted(async () => {
try {
await orgStore.loadOrg();
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
}
});
+3 -2
View File
@@ -8,7 +8,8 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { SecretReference } from "@/components/ui/secret-reference";
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { useSecretEnginesStore } from "@/stores/secret-engines";
/** Where a secret lives. Archie resolves it; the value never reaches the UI. */
@@ -49,7 +50,7 @@ async function check() {
const result = await api.checkSecret(ref);
if (ref.engine === model.value.engine && ref.key === model.value.key) checked.value = result.resolved;
} catch (cause) {
if (ref.engine === model.value.engine && ref.key === model.value.key) checkError.value = String((cause as Error).message || cause);
if (ref.engine === model.value.engine && ref.key === model.value.key) checkError.value = describeError(cause, errors.common.unknown);
} finally { checking.value = false; }
}
</script>
+3 -2
View File
@@ -9,7 +9,8 @@ import { DataTable, type DataTableColumn } from "@/components/ui/data-table";
import { Section } from "@/components/ui/section";
import { Timestamp } from "@/components/ui/timestamp";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
interface AppliedRecord {
kind: string;
@@ -100,7 +101,7 @@ async function load(): Promise<void> {
error.value = null;
} catch (err) {
if (current !== loadGeneration) return;
error.value = String((err as Error).message || err);
error.value = describeError(err, errors.common.unknown);
}
}
+5 -4
View File
@@ -13,7 +13,8 @@ import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel } from "@
import { SettingRow } from "@/components/ui/setting-row";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { useOrgStore, type Identity } from "@/stores/org";
import {
NumberField,
@@ -77,7 +78,7 @@ onMounted(async()=>{
const response=await api.orgAgents<{agents:Identity[]}>(organisation.homeOrg);
if(current!==agentsGeneration)return;
agents.value=response.agents.filter((agent)=>agent.lifecycle==="active");
} catch(cause) {if(current===agentsGeneration)agentError.value=String((cause as Error).message || cause)}
} catch(cause) {if(current===agentsGeneration)agentError.value=describeError(cause, errors.common.unknown)}
});
const resources = computed(() => resourcesForPage(catalog.value, "repositories"));
@@ -121,7 +122,7 @@ function readiness(repo: Repo): { variant: "ok" | "warn" | "danger"; label: stri
if (!repo.connection || !connections.value.some((connection) => connection.id === repo.connection)) return { variant: "warn", label: "No connection" };
const result = results.value[`${repo.owner}/${repo.name}`];
if (!result) return null;
return result.verified ? { variant: "ok", label: "Verified" } : { variant: "danger", label: "Check failed" };
return result.verified ? { variant: "ok", label: "Verified" } : { variant: "danger", label: errors.settings.repos.checkFailed };
}
async function checkAccess(repo:Repo):Promise<void>{
if(unsaved.value || !checkAgent.value || checking.value)return;
@@ -133,7 +134,7 @@ async function checkAccess(repo:Repo):Promise<void>{
const result=await api.checkRepository<AccessCheck>({owner:repo.owner,repository:repo.name,identity_id:checkAgent.value});
if(input===JSON.stringify([repo,checkAgent.value]))results.value[key]=result;
}catch(cause){
if(input===JSON.stringify([repo,checkAgent.value]))results.value[key]={message:String((cause as Error).message || cause)};
if(input===JSON.stringify([repo,checkAgent.value]))results.value[key]={message:describeError(cause, errors.common.unknown)};
}finally{checking.value=""}
}
+2 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { errors } from "@/copy/errors";
import { computed, onMounted, onUnmounted } from "vue";
import PageHeader from "@/base/PageHeader.vue";
@@ -31,7 +32,7 @@ onUnmounted(() => clearInterval(timer));
<div>
<ReadError v-if="catalogError" :message="catalogError" retry-label="Retry" class="mb-4" @retry="store.load()" />
<Alert v-if="config?.reload?.last_error" variant="destructive" class="mb-4">
<AlertTitle>Configuration reload failed</AlertTitle>
<AlertTitle>{{ errors.settings.status.reload }}</AlertTitle>
<AlertDescription>{{ config.reload.last_error }}</AlertDescription>
</Alert>
<ServicesCard />
+5 -4
View File
@@ -15,7 +15,8 @@ import {
TableRow,
} from "@/components/ui/table";
import { Timestamp } from "@/components/ui/timestamp";
import { ApiError, api } from "@/lib/api";
import { ApiError, api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { useLiveResource } from "@/stores/session";
/**
@@ -93,7 +94,7 @@ async function load(): Promise<void> {
canInstall.value = update.can_install;
}
} catch (err) {
loadError.value = err instanceof Error ? err.message : String(err);
loadError.value = describeError(err, errors.common.unknown);
} finally {
loading.value = false;
}
@@ -121,7 +122,7 @@ async function loadOutcome(): Promise<void> {
: null;
outcomeError.value = null;
} catch (err) {
outcomeError.value = err instanceof Error ? err.message : String(err);
outcomeError.value = describeError(err, errors.common.unknown);
}
}
@@ -153,7 +154,7 @@ async function install(): Promise<void> {
installResult.value = `Staged: ${installResult.value}. The outcome appears below after the restart.`;
await load();
} catch (err) {
installError.value = err instanceof Error ? err.message : String(err);
installError.value = describeError(err, errors.common.unknown);
} finally {
installing.value = false;
}
+4 -3
View File
@@ -2,7 +2,8 @@ import { defineStore } from "pinia";
import { ref } from "vue";
import type { Denial, DenialsResponse } from "@/audit/denials";
import { ApiError, api } from "@/lib/api";
import { errors } from "@/copy/errors";
import { ApiError, api, describeError } from "@/lib/api";
/** The caller's org's recorded access denials, newest first. */
export const useDenialsStore = defineStore("denials", () => {
@@ -17,9 +18,9 @@ export const useDenialsStore = defineStore("denials", () => {
error.value = "";
} catch (err) {
if (err instanceof ApiError && err.status === 503) {
error.value = "Denial records are unavailable.";
error.value = errors.stores.denials.unavailable;
} else {
error.value = err instanceof Error && err.message ? err.message : String(err);
error.value = describeError(err, errors.common.unknown);
}
} finally {
loading.value = false;
+6 -3
View File
@@ -1,6 +1,9 @@
import { defineStore } from "pinia";
import { computed, ref } from "vue";
import { errors } from "../copy/errors/index.ts";
import { describeError } from "../lib/api.ts";
export interface Authority {
credential_services: string[];
egress_hosts: string[];
@@ -103,7 +106,7 @@ export const useExtensionsStore = defineStore("extensions", () => {
extensions.value = (await call<{ extensions: Extension[] }>("/api/extensions")).extensions;
error.value = "";
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
}
}
async function load(): Promise<void> {
@@ -113,7 +116,7 @@ export const useExtensionsStore = defineStore("extensions", () => {
catalogue.value = await call<CatalogueEntry[]>("/api/extensions/catalogue");
catalogueError.value = "";
} catch (cause) {
catalogueError.value = String((cause as Error).message || cause);
catalogueError.value = describeError(cause, errors.common.unknown);
} finally {
catalogueLoaded.value = true;
}
@@ -125,7 +128,7 @@ export const useExtensionsStore = defineStore("extensions", () => {
await load();
return true;
} catch (cause) {
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
return false;
} finally {
busy.value = "";
+5 -6
View File
@@ -1,7 +1,8 @@
import { defineStore } from "pinia";
import { computed, onScopeDispose, ref } from "vue";
import { api } from "../lib/api.ts";
import { errors } from "../copy/errors/index.ts";
import { api, describeError } from "../lib/api.ts";
import type { Org } from "../org/org.ts";
import { useSessionStore } from "./session.ts";
@@ -20,8 +21,6 @@ interface OrgList {
member_orgs?: string[];
}
const message = (cause: unknown) => String((cause as Error).message || cause);
/** The orgs the caller can see, the one the Org area shows, and the
* identities that can join them. Read once and shared: every Org tab draws the
* same header, so a per-mount fetch would flash it on every switch. */
@@ -83,7 +82,7 @@ export const useOrgStore = defineStore("org", () => {
const activeIdentities = computed(() => identities.value.filter((actor) => actor.lifecycle === "active"));
function identityName(id: string): string {
return identities.value.find((actor) => actor.id === id)?.display_name || (/^[0-9a-f]+(?:-[0-9a-f]+){4}$/i.test(id) ? "Unavailable identity" : id);
return identities.value.find((actor) => actor.id === id)?.display_name || (/^[0-9a-f]+(?:-[0-9a-f]+){4}$/i.test(id) ? errors.org.identities.unavailable : id);
}
async function loadIdentities(): Promise<void> {
@@ -101,7 +100,7 @@ export const useOrgStore = defineStore("org", () => {
identities.value = (await api.identities<{ identities: Identity[] }>()).identities;
identityError.value = "";
} catch (cause) {
identityError.value = message(cause);
identityError.value = describeError(cause, errors.common.unknown);
} finally {
identitiesLoaded.value = true;
}
@@ -123,7 +122,7 @@ export const useOrgStore = defineStore("org", () => {
await loadIdentities();
return true;
} catch (cause) {
identityError.value = message(cause);
identityError.value = describeError(cause, errors.common.unknown);
return false;
} finally {
identityBusy.value = "";
+3 -2
View File
@@ -1,6 +1,7 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import { api } from "@/lib/api";
import { errors } from "@/copy/errors";
import { api, describeError } from "@/lib/api";
export interface SecretEngine { name: string; version?: string; source: string }
@@ -16,7 +17,7 @@ export const useSecretEnginesStore = defineStore("secret-engines", () => {
error.value = "";
} catch (cause) {
if (current !== generation) return;
error.value = String((cause as Error).message || cause);
error.value = describeError(cause, errors.common.unknown);
}
}
return { engines, error, load };
+6 -5
View File
@@ -1,7 +1,8 @@
import { defineStore } from "pinia";
import { computed, onScopeDispose, reactive, ref, shallowReactive, watch } from "vue";
import { useSessionStore } from "./session.ts";
import { api } from "../lib/api.ts";
import { errors } from "../copy/errors/index.ts";
import { api, describeError } from "../lib/api.ts";
import type { ConfigView } from "../settings/types.ts";
import { diffValues, revertChange, saveInOrder, type Change } from "../lib/changes.ts";
@@ -412,7 +413,7 @@ export const useSettingsStore = defineStore("settings", () => {
).resource,
);
} catch (error) {
state.error = String((error as Error).message || error);
state.error = describeError(error, errors.common.unknown);
} finally {
state.loading = false;
}
@@ -468,7 +469,7 @@ export const useSettingsStore = defineStore("settings", () => {
await loadApplyStatus();
await Promise.all(genericResources.value.map(({ kind }) => loadResource(kind)));
} catch (error) {
catalogError.value = String((error as Error).message || error);
catalogError.value = describeError(error, errors.common.unknown);
}
}
@@ -493,10 +494,10 @@ export const useSettingsStore = defineStore("settings", () => {
} catch (error) {
if (error instanceof ControlPlaneError && error.status === 409) {
state.conflict = true;
state.error = "Changed elsewhere. Latest values loaded.";
state.error = errors.stores.settings.conflict;
await loadResource(kind);
} else {
state.error = String((error as Error).message || error);
state.error = describeError(error, errors.common.unknown);
}
return false;
} finally {
+3 -2
View File
@@ -3,7 +3,8 @@ import { shallowRef } from "vue";
import type { ActivityDetailInput } from "../dashboard/activity-detail.ts";
import type { Setup } from "../dashboard/setup-preference.ts";
import { api } from "../lib/api.ts";
import { errors } from "../copy/errors/index.ts";
import { api, describeError } from "../lib/api.ts";
import { keepRows, keepValue } from "../lib/keep-unchanged.ts";
export interface Summary {
@@ -73,7 +74,7 @@ export const useTasksStore = defineStore("tasks", () => {
taskIDsBySource.value = map;
tasks.value = kept;
} catch (err) {
error.value = String((err as Error).message || err);
error.value = describeError(err, errors.common.unknown);
}
}