fetch: return exception message
instead of returning the exception object
This commit is contained in:
parent
806bb45260
commit
a5bd93ead4
|
@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue