From a5bd93ead48ccc3c016eb8f9ccfd77bf3c8d04b2 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Thu, 23 May 2019 23:37:11 +0200 Subject: [PATCH] fetch: return exception message instead of returning the exception object --- src/util/data.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/data.js b/src/util/data.js index 65d23ce..1de5b64 100644 --- a/src/util/data.js +++ b/src/util/data.js @@ -14,7 +14,7 @@ export async function fetch(url, init) { return { data: await res.json(), error: null } } } catch (e) { - return { data: null, error: "api call failed: " + e } + return { data: null, error: "api call failed: " + e.message } } } @@ -37,7 +37,7 @@ export async function login(username, password, remotesourcename) { return { data: await res.json(), error: null } } } catch (e) { - return { data: null, error: "api call failed: " + e } + return { data: null, error: "api call failed: " + e.message } } } @@ -61,7 +61,7 @@ export async function register(username, remotesourcename, remoteloginname, remo return { data: await res.json(), error: null } } } catch (e) { - return { data: null, error: "api call failed: " + e } + return { data: null, error: "api call failed: " + e.message } } }