From 7696ec9a1375acc3bff32e91c8e678a5ced15159 Mon Sep 17 00:00:00 2001 From: Drew Ansbacher Date: Mon, 15 Nov 2021 16:29:52 -0700 Subject: [PATCH] diagnostic-ui-httpfix --- diagnostic-ui/src/app/pages/home/home.page.ts | 6 ++++++ diagnostic-ui/src/app/services/http.service.ts | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/diagnostic-ui/src/app/pages/home/home.page.ts b/diagnostic-ui/src/app/pages/home/home.page.ts index 9b2fe2788..1fdcb8826 100644 --- a/diagnostic-ui/src/app/pages/home/home.page.ts +++ b/diagnostic-ui/src/app/pages/home/home.page.ts @@ -46,6 +46,12 @@ export class HomePage { problem: 'Storage drive corrupted. This could be the result of data corruption or a physical damage.', solution: 'It may or may not be possible to re-use this drive by reformatting and recovering from backup. To enter recovery mode, click ENTER RECOVERY MODE below, then follow instructions. No data will be erased during this step.' } + } else { + this.error = { + code: error.code, + problem: error.message, + solution: 'Please conact support.' + } } } catch (e) { console.error(e) diff --git a/diagnostic-ui/src/app/services/http.service.ts b/diagnostic-ui/src/app/services/http.service.ts index d95937399..8e814e73f 100644 --- a/diagnostic-ui/src/app/services/http.service.ts +++ b/diagnostic-ui/src/app/services/http.service.ts @@ -12,17 +12,14 @@ export class HttpService { async rpcRequest (options: RPCOptions): Promise { const res = await this.httpRequest>(options) - if (isRpcError(res)) throw new RpcError(res.error) - if (isRpcSuccess(res)) return res.result } async httpRequest (body: RPCOptions): Promise { const url = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/rpc/v1` return this.http.post(url, body) - .toPromise() - .then((res: any) => res.body) + .toPromise().then(a => a as T) .catch(e => { throw new HttpError(e) }) } }