mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-10 07:07:46 +02:00
Show error when not able to get the server list
This commit is contained in:
@@ -9,7 +9,7 @@ type EventCallback<T = any> = (payload: T) => void;
|
||||
|
||||
export type ScriptEvents = {
|
||||
'xcloud.server': {
|
||||
status: 'ready' | 'unavailable' | 'signed-out',
|
||||
status: 'ready' | 'unavailable' | 'signed-out' | 'error',
|
||||
};
|
||||
|
||||
'dialog.shown': {};
|
||||
|
@@ -49,7 +49,13 @@ export class XcloudInterceptor {
|
||||
ip && (request as Request).headers.set('X-Forwarded-For', ip);
|
||||
}
|
||||
|
||||
const response = await NATIVE_FETCH(request, init);
|
||||
let response;
|
||||
try {
|
||||
response = await NATIVE_FETCH(request, init);
|
||||
} catch (e) {
|
||||
BxEventBus.Script.emit('xcloud.server', { status: 'error' });
|
||||
return;
|
||||
}
|
||||
if (response.status !== 200) {
|
||||
// Unsupported region
|
||||
BxEventBus.Script.emit('xcloud.server', { status: 'unavailable' });
|
||||
|
Reference in New Issue
Block a user