@kedaruma/revlm-client 1.0.29 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -1
- package/dist/index.mjs +10 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -388,7 +388,16 @@ var App = class {
|
|
|
388
388
|
const res = await this.__revlm.login(cred.email, cred.password);
|
|
389
389
|
console.log("### App:login res:", res);
|
|
390
390
|
if (!res || !res.ok || !res.token) {
|
|
391
|
-
|
|
391
|
+
const errMsg = res && !res.ok ? res.error : "login failed";
|
|
392
|
+
const err = new Error(errMsg);
|
|
393
|
+
const anyRes = res;
|
|
394
|
+
if (anyRes && typeof anyRes === "object") {
|
|
395
|
+
if (anyRes.code !== void 0) err.code = anyRes.code;
|
|
396
|
+
if (anyRes.status !== void 0) err.status = anyRes.status;
|
|
397
|
+
if (anyRes.reason !== void 0) err.reason = anyRes.reason;
|
|
398
|
+
err.response = anyRes;
|
|
399
|
+
}
|
|
400
|
+
throw err;
|
|
392
401
|
}
|
|
393
402
|
this.__revlm.setToken(res.token);
|
|
394
403
|
const user = new User(this, res.token, res.user);
|
package/dist/index.mjs
CHANGED
|
@@ -345,7 +345,16 @@ var App = class {
|
|
|
345
345
|
const res = await this.__revlm.login(cred.email, cred.password);
|
|
346
346
|
console.log("### App:login res:", res);
|
|
347
347
|
if (!res || !res.ok || !res.token) {
|
|
348
|
-
|
|
348
|
+
const errMsg = res && !res.ok ? res.error : "login failed";
|
|
349
|
+
const err = new Error(errMsg);
|
|
350
|
+
const anyRes = res;
|
|
351
|
+
if (anyRes && typeof anyRes === "object") {
|
|
352
|
+
if (anyRes.code !== void 0) err.code = anyRes.code;
|
|
353
|
+
if (anyRes.status !== void 0) err.status = anyRes.status;
|
|
354
|
+
if (anyRes.reason !== void 0) err.reason = anyRes.reason;
|
|
355
|
+
err.response = anyRes;
|
|
356
|
+
}
|
|
357
|
+
throw err;
|
|
349
358
|
}
|
|
350
359
|
this.__revlm.setToken(res.token);
|
|
351
360
|
const user = new User(this, res.token, res.user);
|