fix: 🐛 Fix asciicast errors not being shown properly (#333)
✅ Closes: ICU-9673
This commit is contained in:
1 parent
2a6a41104a
commit
178e92a812
3 files changed
+41
-2
No files matched your search
@@ -39,7 +39,15 @@ export default class SessionRecordingAdapter extends ApplicationAdapter {
|
||||
});
|
||||
|
||||
const response = await fetch(url, { headers: this.headers });
|
||||
return response.text();
|
||||
if (response?.ok) {
|
||||
return response.text();
|
||||
} else {
|
||||
throw this.handleResponse(
|
||||
response.status,
|
||||
response.headers,
|
||||
await response.text()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-1
@@ -16,7 +16,11 @@ export default class ScopesScopeSessionRecordingsSessionRecordingChannelsByConne
|
||||
);
|
||||
|
||||
if (this.can.can('getAsciicast channel-recording', channelRecording)) {
|
||||
asciicast = await channelRecording.getAsciicast();
|
||||
try {
|
||||
asciicast = await channelRecording.getAsciicast();
|
||||
} catch (e) {
|
||||
// no op
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
+27
@@ -3,6 +3,7 @@ import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
|
||||
module(
|
||||
'Acceptance | session recordings | session recording | channels by connection | channel',
|
||||
@@ -95,6 +96,32 @@ module(
|
||||
assert.dom('.session-recording-player').doesNotExist();
|
||||
});
|
||||
|
||||
test('user cannot view recording if asciicast download errors out', async function (assert) {
|
||||
assert.expect(2);
|
||||
this.server.get(
|
||||
`/session-recordings/${instances.channelRecording.id}:download`,
|
||||
() =>
|
||||
new Response(
|
||||
500,
|
||||
{},
|
||||
{
|
||||
status: 500,
|
||||
code: 'api_error',
|
||||
message: 'rpc error: code = Unknown',
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
// Visit channel
|
||||
await visit(urls.connectionRecording);
|
||||
|
||||
// if there was an error player will not render
|
||||
assert.dom('.session-recording-player').doesNotExist();
|
||||
assert
|
||||
.dom('.hds-application-state__title')
|
||||
.hasText("We can't play back this channel because the file is missing");
|
||||
});
|
||||
|
||||
test('user can navigate back to session recording screen', async function (assert) {
|
||||
assert.expect(1);
|
||||
// Visit channel
|
||||
|
||||
Reference in new issue
Block a user