react-native-update-cli 1.30.2 → 1.30.3

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/lib/api.js CHANGED
@@ -103,7 +103,11 @@ async function query(url, options) {
103
103
  try {
104
104
  json = JSON.parse(text);
105
105
  } catch (e) {
106
- throw new Error(`Server error: ${text}`);
106
+ if (resp.statusText.includes('Unauthorized')) {
107
+ throw new Error('登录信息已过期,请使用 pushy login 命令重新登录');
108
+ } else {
109
+ throw new Error(`Server error: ${resp.statusText}`);
110
+ }
107
111
  }
108
112
 
109
113
  if (resp.status !== 200) {
@@ -195,7 +199,7 @@ async function uploadFile(fn, key) {
195
199
  return reject(err);
196
200
  }
197
201
  if (resp.statusCode > 299) {
198
- return reject(Object.assign(new Error(JSON.stringify(body)), {
202
+ return reject(Object.assign(new Error(body), {
199
203
  status: resp.statusCode
200
204
  }));
201
205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "1.30.2",
3
+ "version": "1.30.3",
4
4
  "description": "Command tools for javaScript updater with `pushy` service for react native apps.",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/api.js CHANGED
@@ -66,7 +66,11 @@ async function query(url, options) {
66
66
  try {
67
67
  json = JSON.parse(text);
68
68
  } catch (e) {
69
- throw new Error(`Server error: ${text}`);
69
+ if (resp.statusText.includes('Unauthorized')) {
70
+ throw new Error('登录信息已过期,请使用 pushy login 命令重新登录');
71
+ } else {
72
+ throw new Error(`Server error: ${resp.statusText}`);
73
+ }
70
74
  }
71
75
 
72
76
  if (resp.status !== 200) {
@@ -166,7 +170,7 @@ export async function uploadFile(fn, key) {
166
170
  }
167
171
  if (resp.statusCode > 299) {
168
172
  return reject(
169
- Object.assign(new Error(JSON.stringify(body)), {
173
+ Object.assign(new Error(body), {
170
174
  status: resp.statusCode,
171
175
  }),
172
176
  );