fix(ext): ERROR_COPY entries for org context errors (read-UI surfacing)
A's org foundation returns org_not_configured (ok:false) plus thrown not_an_org_member / device_key_unavailable, none of which had user-facing copy — they would render as the raw code. Add friendly copy (org_not_configured ties into the add-org flow) and a focused test; fixes the ERROR_COPY-coverage test that the foundation merge left red. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W3b8DA2mXmLWkd4zDbHXHg
This commit is contained in:
@@ -41,4 +41,15 @@ describe('ERROR_COPY', () => {
|
||||
expect(copy.title).toBe('Something went wrong');
|
||||
expect(copy.body).toContain('made_up_code_xyz');
|
||||
});
|
||||
|
||||
// The discovery test above only catches codes returned via `ok: false, error: '<literal>'`
|
||||
// (org_not_configured). The other user-facing org errors are thrown (-> e.message ->
|
||||
// humanizeError), so assert they resolve to real copy rather than the generic fallback.
|
||||
it('maps the user-facing org error codes to friendly copy', () => {
|
||||
for (const code of ['org_not_configured', 'not_an_org_member', 'device_key_unavailable']) {
|
||||
const copy = lookupErrorCopy(code);
|
||||
expect(copy.title).not.toBe('Something went wrong');
|
||||
expect(copy.body).not.toBe(code);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -100,6 +100,20 @@ export const ERROR_COPY: Record<string, ErrorCopy> = {
|
||||
body: 'Run setup to save your reference image.',
|
||||
cta: { label: 'Open setup', action: 'open_setup' },
|
||||
},
|
||||
// --- Org (enterprise) context errors (v0.9.0 Plan B) ---
|
||||
org_not_configured: {
|
||||
title: 'Org not set up here',
|
||||
body: 'This organization is not configured on this device yet. Add it from the vault switcher before browsing its items.',
|
||||
},
|
||||
not_an_org_member: {
|
||||
title: 'Not a member',
|
||||
body: "This device isn't a member of that organization — ask an org admin to add your device key.",
|
||||
},
|
||||
device_key_unavailable: {
|
||||
title: 'Device key unavailable',
|
||||
body: 'Your device key could not be restored. Lock and unlock your vault to refresh it, then try again.',
|
||||
cta: UNLOCK_CTA,
|
||||
},
|
||||
};
|
||||
|
||||
export function lookupErrorCopy(code: string): ErrorCopy {
|
||||
|
||||
Reference in New Issue
Block a user