mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-11 01:39:41 +02:00
fix(uploads): show the server's reason when a prompt upload fails
A failed upload only showed a count, so a remote session's refused upload read as a mystery instead of a rule the user could act on. The server already returns the reason in its error envelope and the per-file error carries it, so I surface the first one in the toast. One reason is enough when a whole batch fails for the same cause.
This commit is contained in:
@@ -238,4 +238,16 @@ describe('image upload insertion policy', () => {
|
||||
expect(app._uploadPasteImage).toHaveBeenCalledWith('session-b', { path: '/tmp/pane-b.png' });
|
||||
expect(app._sendInputAsync).toHaveBeenCalledWith('session-b', '/tmp/pane-b.png', { useMux: true });
|
||||
});
|
||||
|
||||
it('shows the server reason in the toast when an upload fails', async () => {
|
||||
const app = loadImageInputApp();
|
||||
const reason = 'Prompt uploads are not supported for remote (SSH) sessions';
|
||||
app._uploadPasteImage = vi.fn(async () => {
|
||||
throw new Error(reason);
|
||||
});
|
||||
|
||||
await app._uploadAndInsertImages([{ path: '/tmp/shot.png' }]);
|
||||
|
||||
expect(app.showToast).toHaveBeenCalledWith(`1 failed: ${reason}`, 'error');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user