fetch: return exception message

instead of returning the exception object
This commit is contained in:
Simone Gotti 2019-05-23 23:37:11 +02:00
parent 806bb45260
commit a5bd93ead4
1 changed files with 3 additions and 3 deletions

View File

@ -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 }
}
}