fix: surface Spotify quota exhaustion
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
358d058392
commit
bfea9efb5e
6 changed files with 97 additions and 10 deletions
|
|
@ -8,7 +8,9 @@ defineEmits<{ retry: [] }>()
|
|||
<template>
|
||||
<div class="error" role="alert" :data-error-code="code">
|
||||
<p>{{ message }}</p>
|
||||
<button type="button" @click="$emit('retry')">{{ messages.streamErrorRetry }}</button>
|
||||
<button v-if="code !== 'quota_exhausted'" type="button" @click="$emit('retry')">
|
||||
{{ messages.streamErrorRetry }}
|
||||
</button>
|
||||
<a v-if="demoUrl" class="demo-link" :href="demoUrl">
|
||||
{{ messages.streamErrorDemoInstance }}
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -166,6 +166,34 @@ describe('result presentation', () => {
|
|||
expect(onPick).toHaveBeenCalledWith('Focus')
|
||||
})
|
||||
|
||||
it('renders a quota error without retry and keeps the demo escape hatch', () => {
|
||||
const turn: AssistantTurn = {
|
||||
...doneTurn(),
|
||||
status: 'error',
|
||||
tracks: [],
|
||||
warnings: [],
|
||||
error: {
|
||||
type: 'error',
|
||||
code: 'quota_exhausted',
|
||||
message: "Spotify's Development Mode quota is temporarily exhausted.",
|
||||
},
|
||||
completion: null,
|
||||
}
|
||||
const demoUrl = 'https://demo.example.com'
|
||||
const root = mountComponent(AssistantMessage, {
|
||||
turn,
|
||||
canSave: false,
|
||||
demoUrl,
|
||||
})
|
||||
const alert = root.querySelector<HTMLElement>('[role="alert"]')
|
||||
const demoLink = alert?.querySelector<HTMLAnchorElement>('a')
|
||||
|
||||
expect(alert?.dataset.errorCode).toBe('quota_exhausted')
|
||||
expect(alert?.querySelector('button')).toBeNull()
|
||||
expect(demoLink?.href).toBe(`${demoUrl}/`)
|
||||
expect(demoLink?.textContent).toContain('Open the demo instance')
|
||||
})
|
||||
|
||||
it('renders a first-stage stream error with its code and message', () => {
|
||||
const turn: AssistantTurn = {
|
||||
...doneTurn(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue